Closed
Bug 749862
Opened 12 years ago
Closed 12 years ago
findElements with css selector only returns a single element
Categories
(Remote Protocol :: Marionette, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla15
People
(Reporter: jlal, Assigned: mdas)
Details
Attachments
(2 files, 1 obsolete file)
3.01 KB,
text/html
|
Details | |
4.83 KB,
patch
|
jgriffin
:
review+
|
Details | Diff | Splinter Review |
While testing the marionette js driver I found that findElements fails to return all of the elements that match the selector. in the python driver I see a similar result except it causes an error inside the python script. //start session marionette.find_elements('css selector', 'div'); // one element returns marionette.find_elements('tag name', 'div'); //42 elements marionette.execute_script('return document.querySelectorAll(\'div\').length; '); //42 elements Attached is the contents of the body element on the page I was testing this command on. This is actually the system app in b2g.
Assignee | ||
Comment 1•12 years ago
|
||
querySelectorAll returns a NodeList, and not a list of elements, so this was just a quick fix. I found a similar problem with find_elements("name",...), so I fixed that in this patch. I updated the tests to try a basic find_elements() call for each supported search type.
Attachment #621714 -
Flags: review?(jgriffin)
Comment 2•12 years ago
|
||
Comment on attachment 621714 [details] [diff] [review] Fix v0.1 Review of attachment 621714 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/marionette/marionette-elements.js @@ +402,5 @@ > elements = this.findByXPathAll(rootNode, value, startNode); > break; > case NAME: > + elements = startNode.getElementsByName ? > + startNode.getElementsByName(value) : reindent @@ +429,5 @@ > case SELECTOR: > + let matches = rootNode.querySelectorAll(value); > + for (let i = 0; i < matches.length; i++) { > + elements.push(matches[i]); > + } elements = Array.prototype.slice.call(matches); tends to be how people do this
Assignee | ||
Comment 3•12 years ago
|
||
Thanks, I've updated the patch
Attachment #621714 -
Attachment is obsolete: true
Attachment #621714 -
Flags: review?(jgriffin)
Attachment #621727 -
Flags: review?(jgriffin)
Comment 4•12 years ago
|
||
Comment on attachment 621727 [details] [diff] [review] Fix v0.2 Thanks!
Attachment #621727 -
Flags: review?(jgriffin) → review+
Comment 5•12 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/6d4fbeb32fbf
Assignee: nobody → mdas
Target Milestone: --- → mozilla15
Comment 6•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6d4fbeb32fbf
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•