Bug 1274550 - Return web element from Get Active Element; r?automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 26 May 2016 13:04:22 +0100
changeset 371440 904b31633be86bb27e9a1142ee523bad0655e5bc
parent 371406 b0096c5c727749ad3e79cbdf20d2e96bd179c213
child 371441 b447cff08ee2bfcc7fcc7c9b48376311a63549c8
push id19329
push userbmo:ato@mozilla.com
push dateThu, 26 May 2016 16:33:07 +0000
reviewersautomatedtester
bugs1274550
milestone49.0a1
Bug 1274550 - Return web element from Get Active Element; r?automatedtester MozReview-Commit-ID: I5WHfJbMfPZ
testing/marionette/listener.js
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1061,29 +1061,20 @@ function* findElementsContent(strategy, 
   }
 
   let els = yield element.find(curContainer, strategy, selector, opts);
   let elRefs = seenEls.addAll(els);
   let webEls = elRefs.map(element.makeWebElement);
   return webEls;
 }
 
-/**
- * Find and return the active element on the page.
- *
- * @return {WebElement}
- *     Reference to web element.
- */
+/** Find and return the active element on the page. */
 function getActiveElement() {
   let el = curContainer.frame.document.activeElement;
-  let elRef = seenEls.add(el);
-  // TODO(ato): This incorrectly returns
-  // the element's associated UUID as a string
-  // instead of a web element.
-  return elRef;
+  return element.toJson(el, seenEls);
 }
 
 /**
  * Send click event to element.
  *
  * @param {WebElement} id
  *     Reference to the web element to click.
  */