Michael Okarimia's Code Blog

Tag: Webdriver

Allow Selenium Webdriver C# tests to accept javascript popup alerts

by on Sep.23, 2011, under Handy Tips

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();

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!