Archive for September, 2011

Allow Selenium Webdriver C# tests to accept javascript popup alerts

I have been writing Selenium webdriver powered tests for over a year, as part of a suit of acceptance tests, and I was looking to prevent a test from failing when a JavaScript pop up alert interrupted the tests completion.

I found the non C# solution blogged but I’ve written the code in C# below:

1
WebDriver.SwitchTo().Alert().Accept();

,

No Comments