Sep 6, 2011

Selenium 2.0 dark secret has been unlocked

Never ever focus on the Firefox window, which is being tested with Selenium.

This is because it will mess up the events and some clicking, specifically <a> and <button>,will fail.

(I have done a solid experiment on it. I have tested 4 elements, span, anchor, button, and input[button]. Only anchor and button have the problem)

----------------

OMG, I have solved it.

By focusing and send_keys "\n", the clicking problem is gone !!

Please be aware that the clicking problem only occurs with the anchor tag, and this approach does not work with other tags.

Therefore, please use the below code:



YESSSSS!


--------------------

I have found a problem with <button> that contains a span inside. But I could not repeat the problem. So, I'll just make a note right here for future reference.