Wednesday, June 18, 2014

Clicking problems with IE and Selenium

We were facing couple of problems with selenium tests running on IE, when running the tests locally, we don't have these issues. After adding more logs to the code, i found that sometimes it is failing after sending the click event in different steps. 
Looking online for similar issue, i found that there are clicking issues with IE, as sometimes the element being clicked on will receive the focus, but the click will not be processed by the element.
https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Browser_Focus

To workaround this, i am setting the focus manually to the browser using the below line of code

Driver.SwitchTo().Window(Driver.CurrentWindowHandle);