Bug 1094441: Allow CSS Selector as a search strategy for Marionette in Chrome context; r=ahal

--HG--
extra : rebase_source : bfbd853e362e62d55ffb0fefff36667aa60ca04f
This commit is contained in:
David Burns 2014-11-18 22:57:23 +00:00
Родитель 8d09083020
Коммит 73f70ec38e
3 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -1298,7 +1298,7 @@ class Marionette(object):
:param method: The method to use to locate the element; one of: "id",
"name", "class name", "tag name", "css selector", "link text",
"partial link text", "xpath", "anon" and "anon attribute".
Note that the "name", "css selector", "link text" and
Note that the "name", "link text" and
"partial link test" methods are not supported in the chrome dom.
:param target: The target of the search. For example, if method =
"tag", target might equal "div". If method = "id", target would be
@ -1325,7 +1325,7 @@ class Marionette(object):
:param method: The method to use to locate the elements; one of:
"id", "name", "class name", "tag name", "css selector", "link text",
"partial link text", "xpath", "anon" and "anon attribute".
Note that the "name", "css selector", "link text" and
Note that the "name", "link text" and
"partial link test" methods are not supported in the chrome dom.
:param target: The target of the search. For example, if method =
"tag", target might equal "div". If method = "id", target would be

Просмотреть файл

@ -29,6 +29,12 @@ class TestElementsChrome(MarionetteTestCase):
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_that_we_can_find_elements_from_css_selectors(self):
el = self.marionette.execute_script("return window.document.getElementById('textInput');")
found_el = self.marionette.find_element(By.CSS_SELECTOR, "#textInput")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_child_element(self):
el = self.marionette.find_element(By.ID, "textInput")
parent = self.marionette.find_element(By.ID, "things")

Просмотреть файл

@ -2899,7 +2899,7 @@ function BrowserObj(win, server) {
this.startPage = "about:blank";
this.mainContentId = null; // used in B2G to identify the homescreen content page
this.newSession = true; //used to set curFrameId upon new session
this.elementManager = new ElementManager([SELECTOR, NAME, LINK_TEXT, PARTIAL_LINK_TEXT]);
this.elementManager = new ElementManager([NAME, LINK_TEXT, PARTIAL_LINK_TEXT]);
this.setBrowser(win);
this.frameManager = new FrameManager(server); //We should have one FM per BO so that we can handle modals in each Browser