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?
}
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.
Are you using Firefox 4.x or above? There seems to be an issue with Firefox 4.x and Selenium: Firefox 4 confirmation dialog in selenium 2.0b3 The suggested solution is to migrate to Selenium/WebDriver.
精彩评论