I am using Selenium 2 2.16 build. I've been running into problems where I get a variable response to a
click() call, where sometimes the click activates the behaviour behind the element (new page loads) and sometimes it does not. As
click() doesn't return anything, I can't trap for those occurences where the driver doesn't go to a new page.
Here's a code snippet :
// Find the User Profile Button def userProfileButton = driver.findElement(By.className("user")) assert userProfileButton.isEnabled() assert userProfileButton.getText() == "Facility Administrator" userProfileButton.findElement(By.tagName("a")).click() // Check User Profile page loads def userProfilePanel = driver.findElement(By.id("profile-panel")) .... do some tests on the userProfilePanel
So I am locating the link, checking it is enabled and has the right name, then clicking on it. The next step will sometimes time out (I have the driver set to wait up to 10 seconds before timing out), as the new page is not loaded. Other times, it works fine.
This is not the only case I have where the
click() is unreliable. Do other people have similar problems?
I'd prefer not to use the work around I've seen which is to call
sendkeys(Enter), as I'd like to simulate the real user clicks and data entry if at all possible.