First off, sorry for the cryptic question.
My team is currently using Selenium 2.0rc3 (with python) for testing our web app with chrome. When we used the 2.02b version of Selenium, our test passed (it was a little slow and we had small hacks that we added to webdriver). After we upgraded, the test became extremely fast and started failing. After debugging we found out most test failed because webdrivers click() function was not blocking() successive calls. Currently we added a sleep()/timeout of .5 secs after each click and while this solves the immediate problem, it doesn’t quite achieve our main goal (which is to speed up our test)
Your problem is not really that it’s clicking too fast. Just that it’s clicking before that element is present. There are two ways to get round this:
I’m afraid I haven’t used the WebDriver Python bindings. However, I can tell you how it is done in Java and hopefully you can find the Python equivalent yourself.
To wait for an element, we have in Java a class called
WebDriverWait. You would write aFunctionwhich you pass to theuntil()method which passes only when the element exists. One way you could do that is withdriver.findElements( By... )or wrapdriver.findElement( By... )in an exception handler. TheFunctionis polled till it returns true or the timeout specified is hit.The second method is the preferred method for your case and in Java you can do
driver.manage().timeouts().implicitlyWait( ... ).