Closed
Bug 799008
Opened 13 years ago
Closed 13 years ago
findElements does not scope to parent
Categories
(Remote Protocol :: Marionette, defect)
Tracking
(firefox18 fixed, firefox19 fixed)
RESOLVED
FIXED
mozilla19
People
(Reporter: jlal, Assigned: fredy)
Details
Attachments
(1 file, 2 obsolete files)
2.54 KB,
patch
|
automatedtester
:
review+
|
Details | Diff | Splinter Review |
STR:
marionette.navigate('https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Marionette_for_Interactive_Python')
head = marionette.find_element('css selector', '#article-head')
head.find_elements('css selector', 'div')
expected:
find elements to return the single 'div' element inside #article-head
actual:
all div elements in the entire document are returned.
--
My best guess is this related to: https://mxr.mozilla.org/mozilla-central/source/testing/marionette/marionette-elements.js#251
My build is from October 2nd (which is far after this code has been modified).
Reporter | ||
Comment 1•13 years ago
|
||
the workaround is to do something like
marionette.find_elements('css selector', '#article-head div');
Assignee | ||
Comment 2•13 years ago
|
||
At findElements function, on css-selector case, searching for the elements always starts at the rootNode which is the document and not at the current node (startNode).
The attached patch corrects this behavior.
Attachment #669143 -
Flags: review?
Comment 3•13 years ago
|
||
Comment on attachment 669143 [details] [diff] [review]
bugfix
Can you add a test case for this too?
Attachment #669143 -
Flags: review? → review?(dburns)
Assignee | ||
Comment 4•13 years ago
|
||
Attachment #669143 -
Attachment is obsolete: true
Attachment #669143 -
Flags: review?(dburns)
Attachment #672024 -
Flags: review?(dburns)
Comment 5•13 years ago
|
||
Comment on attachment 672024 [details] [diff] [review]
fix and unit test
>
>+ def test_selector_scope(self):
Can we make the test name more verbose so we can, at a glance, work out what it is supposed to do. E.g. test_css_selector_scope_doesnt_start_at_rootnode
>+ el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
>+ nav_el = self.marionette.execute_script("return window.document.getElementById('testDiv');")
Why are you using execute script instead of find_element here?
Assignee | ||
Comment 6•13 years ago
|
||
(In reply to David Burns :automatedtester from comment #5)
> Comment on attachment 672024 [details] [diff] [review]
> fix and unit test
>
>
> >
> >+ def test_selector_scope(self):
>
> Can we make the test name more verbose so we can, at a glance, work out what
> it is supposed to do. E.g. test_css_selector_scope_doesnt_start_at_rootnode
>
Yes, that's sound better. I am going to fix that.
> >+ el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
> >+ nav_el = self.marionette.execute_script("return window.document.getElementById('testDiv');")
>
> Why are you using execute script instead of find_element here?
I just saw it on some other tests in the same file, e.g. test_xpath.
I thought also that, just in case, the find_element function don't work, using execute script will make this test pass.
I can also fix this behavior.
Assignee | ||
Comment 7•13 years ago
|
||
(In reply to Alfredos-Panagiotis Damkalis (irc: fredy) from comment #6)
> Yes, that's sound better. I am going to fix that.
>
*that sounds better
Assignee | ||
Comment 8•13 years ago
|
||
Name of the test is fixed and the execute_scripts replaced with find_element.
Attachment #672024 -
Attachment is obsolete: true
Attachment #672024 -
Flags: review?(dburns)
Attachment #672541 -
Flags: review?(dburns)
Comment 9•13 years ago
|
||
Comment on attachment 672541 [details] [diff] [review]
patch v2
awesome work!
Attachment #672541 -
Flags: review?(dburns) → review+
Comment 10•13 years ago
|
||
Comment 11•13 years ago
|
||
Assignee: nobody → fredy
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Updated•13 years ago
|
Whiteboard: [automation-needed-in-aurora]
Comment 12•13 years ago
|
||
Comment 13•13 years ago
|
||
status-firefox18:
--- → fixed
status-firefox19:
--- → fixed
Whiteboard: [automation-needed-in-aurora]
Updated•3 years ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•