Posts Tagged Webdriver
Allow Selenium Webdriver C# tests to accept javascript popup alerts
Posted by Michael Okarimia in Handy Tips on September 23, 2011
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(); |