Sep 16, 2011

Selenium Superbug (Clicking problem)

Today I have just found out that Selenium WebDriver won't click on anything that is not on the current view.

This problem occurs because my HTML is somehow strangely designed that it makes Firefox(and Selenium) miscalculates the position of a target button. (My guess is floating css causes it.)

Selenium always scroll to the button before the clicking happens.

This time the button is not even in Firefox's view.

The direct fix would be to redesign the HTML or fix Selenium or Firefox.

Well, I cannot do that. So what I have done is changing the stylesheet of the button before clicking in order to make it visible in the view, and revert it back later.

The css I have added is {position:fixed; left:0px; top:0px;}