Selenium click() event seems not to be always triggered => results in timeout? Selenium click() event seems not to be always triggered => results in timeout? selenium selenium

Selenium click() event seems not to be always triggered => results in timeout?


Sometimes, seemingly randomly, Selenium just doesn't like to click certain anchor tags. I am not sure what causes it, but it happens. I find in those cases w/ a troublesome link instead of doing

selenium.click(...)

do

selenium.fireEvent( locator, 'click' );

As others have stated above me, I have specifically had issues with anchor tags that appear as follows:

<a href="javascript:...." >


I've done selenium for awhile, and I really have developed a dislike for waitForPageToLoad(). You might consider always just waiting for the element in question to exist.

I find that this method seems to resolve most weird issues I run into like this. The other possibility is that you may have some javascript preventing the link from doing anything when clicked the first time. It seems unlikely but worth a double-check.


I just tried WebDriver (Selenium 2.0) and found that WebElement#sendKeys(Keys.ENTER) works.