I am writing tests for a web application. Some commands pull up dialog boxes that have controls that are visible, but not available for a few moments. (They are greyed out, but webdriver still sees them as visible).
How can I tell Selenium to wait for the element to be actually accessible, and not just visible?
try:
print "about to look for element"
element = WebDriverWait(driver, 10).until(lambda driver : driver.find_element_by_id("createFolderCreateBtn"))
print "still looking?"
finally: print 'yowp'
Here is the code that I have tried, but it “sees” the button before it is usable and basically charges right past the supposed “wait”.
Note that I can stuff a ten second sleep into the code instead of this and the code will work properly, but that is ugly, unreliable, and inefficient. But it does prove that the problem is just that “click” command is racing ahead of the availability of the controls.
Here is what we ended up with. (Thanks to lukeis and RossPatterson.) Note that we had to find all the items by id and then filter by “disabled”. I would have preferred a single search pattern, but what can you do?