Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clicking Confirm Dialog Selenium in .NET

I'm trying to make Selenium 2.4.0 Accept a Javascript generated "Confirm-Dialog", using Specflow and Firefox. I'm having trouble finding what I should do in my step below. (Tried to find an equivalent way of doing it in .NET from various Java implementations, but it isn't working)

When I click "Delete" on the App
    And I confirm the warning

Step definition...

[When(@"I confirm the warning")]
public void WhenIConfirmTheWarning()
{
    // WebDriver.Something?
}
like image 845
ullmark Avatar asked Aug 15 '11 09:08

ullmark


1 Answers

The way to confirm the alert in the .NET bindings is as follows:

driver.SwitchTo().Alert().Accept();

I have had this working with the Selenium .NET bindings 2.4.0, using Firefox 5.0.

like image 111
JimEvans Avatar answered Nov 16 '22 18:11

JimEvans