Skip to content

Commit

Permalink
Bug 1277083: Have getElementProperty return element properties in chr…
Browse files Browse the repository at this point in the history
…ome. r=jgriffin

This removes the UnknowOperationError that was being thrown and returns the
property on the element that has been requested.

MozReview-Commit-ID: 2WCnBfdmit5

--HG--
extra : rebase_source : 92549bc482b3cf383bef35efa3ad10b3bcb0153e
  • Loading branch information
David Burns committed May 31, 2016
1 parent b587f77 commit 7f050b4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion testing/marionette/driver.js
Expand Up @@ -1811,7 +1811,10 @@ GeckoDriver.prototype.getElementProperty = function*(cmd, resp) {

switch (this.context) {
case Context.CHROME:
throw new UnsupportedOperationError();
let win = this.getCurrentWindow();
let el = this.curBrowser.seenEls.get(id, {frame: win});
resp.body.value = el[name];
break;

case Context.CONTENT:
return this.listener.getElementProperty(id, name);
Expand Down
Expand Up @@ -66,3 +66,22 @@ def tearDown(self):
def test_get(self):
el = self.marionette.execute_script("return window.document.getElementById('textInput');")
self.assertEqual(el.get_attribute("id"), "textInput")

class TestGetElementProperty(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_context("chrome")
self.win = self.marionette.current_window_handle
self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
self.marionette.switch_to_window('foo')
self.assertNotEqual(self.win, self.marionette.current_window_handle)

def tearDown(self):
self.assertNotEqual(self.win, self.marionette.current_window_handle)
self.marionette.execute_script("window.close();")
self.marionette.switch_to_window(self.win)
MarionetteTestCase.tearDown(self)

def test_get(self):
el = self.marionette.execute_script("return window.document.getElementById('textInput');")
self.assertEqual(el.get_property("id"), "textInput")

0 comments on commit 7f050b4

Please sign in to comment.