One of my Selenium tests issues a click on a button to create a new user:
seleniumDriver.findElement(By.xpath("//input[@value='Save']")).click();
However, the validation fails (it is meant to fail!) so that a <div> is displayed to inform the user to correct some input fields. This works very well manually, but the automated test aborts with the following error message:
com.thoughtworks.selenium.SeleniumException: Timed out waiting for action to finish
at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:44)
at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:145)
at org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:75)
at com.thoughtworks.selenium.DefaultSelenium.click(DefaultSelenium.java:193)
at com.holcim.logon.admin.web.admin.UserTest.createUser(UserTest.java:354
How is it possible that a click() ends up in a timeout? And how could I possible fix this?
possible solution to your problem:
1) instead of xPath find css selector of the needed element.
it gonna be something like:
but before you gonna use it verify in firepath, firebug addon in ffox that needed element is located properly.
After we obtained needed css selector, we can use approach that always works. using js function that
will perform a click on the needed element.
Hope this works for you now.