Bug 1517196 - [marionette] Raise "no such element" error in "Switch To Frame" for unknown elements. r=ato
authorHenrik Skupin <mail@hskupin.info>
Wed, 09 Jan 2019 16:21:58 +0000
changeset 453063 68dbd12b85475b9bb6dc19cc2c45a3158f140b97
parent 453062 cb2753660aa7b2c637531ce455663a53318fc877
child 453064 227e15964de828de138b0b01b28e07f384b2f247
push id35344
push usershindli@mozilla.com
push dateWed, 09 Jan 2019 21:41:24 +0000
treeherdermozilla-central@47ced8013922 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1517196
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1517196 - [marionette] Raise "no such element" error in "Switch To Frame" for unknown elements. r=ato Differential Revision: https://phabricator.services.mozilla.com/D16049
testing/marionette/listener.js
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1395,17 +1395,24 @@ function switchToFrame(msg) {
     sendOk(commandID);
     return;
   }
 
   let webEl;
   if (typeof msg.json.element != "undefined") {
     webEl = WebElement.fromUUID(msg.json.element, "content");
   }
-  if (webEl && seenEls.has(webEl)) {
+
+  if (webEl) {
+    if (!seenEls.has(webEl)) {
+      let err = new NoSuchElementError(`Unable to locate element: ${webEl}`);
+      sendError(err, commandID);
+      return;
+    }
+
     let wantedFrame;
     try {
       wantedFrame = seenEls.get(webEl, curContainer.frame);
     } catch (e) {
       sendError(e, commandID);
       return;
     }