开发者

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?
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜