You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
So basically in my test if I do something like: self.driver.find_elements_by_css_selector(".somethingnothere")
it takes 10 seconds for a response to come back. I am using the python version of
selenium with the latest version. I've reproduced this on Firefox and Chrome. All of
my tests are being run through a selenium server, either locally or through sauce labs.
Reproduce steps(python):
def test_slow_selecting_of_elements(self):
self.driver.get("http://www.google.com")
self.driver.find_elements_by_css_selector(".somethingnothere")
print "This took 10 seconds"
self.driver.find_elements_by_css_selector(".somethingnothere")
print "This took another 10 seconds"
The server log looks like this:
16:24:28.562 INFO - Executing: [find elements: By.selector: .somethingnothere] at URL:
/session/1342481057828/elements)
16:24:38.609 INFO - Done: /session/1342481057828/elements
16:24:38.671 INFO - Executing: [find elements: By.selector: .somethingnothere] at URL:
/session/1342481057828/elements)
16:24:48.718 INFO - Done: /session/1342481057828/elements
Selenium version: 2.24.0
OS: Mac/Windows
Browser: Firefox and Chrome
Browser version: Firefox 6, Chrome Latest
Reported by boneill428 on 2012-07-16 23:55:30
The text was updated successfully, but these errors were encountered:
I bet you are using implicit wait timeout set to 10 seconds.
When searching for multiple elements, the driver polls the page until at least one
element has been found or this timeout has expired.
True. You are right. Our implicit wait is set to 10 seconds. It did, however, allow
me to find another issue. With find_element_by_css_selector if it doesn't find anything
after 10 seconds it returns an exception, "NoSuchElementException: Message: u'Unable
to locate element:"
When using find_elements_by_css_selector there is no exception when it doesn't find
any elements, it just continues on with the rest of the test.
This is still the exactly the intended behavior. The findElement (singular) throws an
exception when an element is not found. The findElements (plural) method never throws
an exception; it returns a collection with zero elements. The only thing using an implicit
wait does is delay the result (an exception or an empty collection) until the timeout
if no element meets the criteria.
Reported by james.h.evans.jr on 2012-07-17 21:58:41
Originally reported on Google Code with ID 4262
Reported by
boneill428
on 2012-07-16 23:55:30The text was updated successfully, but these errors were encountered: