我正在尝试使用 Specflow 和 Firefox 使 Selenium 2.4.0 接受 Javascript 生成的“Confirm-Dialog”。我在下面的步骤中找不到我应该做什么。 (试图从各种 Java 实现中找到在 .NET 中执行此操作的等效方法,但它不起作用)
When I click "Delete" on the App
And I confirm the warning
步骤定义...
[When(@"I confirm the warning")]
public void WhenIConfirmTheWarning()
{
// WebDriver.Something?
}
最佳答案
在.NET绑定(bind)中确认告警的方式如下:
driver.SwitchTo().Alert().Accept();
我已经使用 Firefox 5.0 使用 Selenium .NET 绑定(bind) 2.4.0。
关于c# - 在 .NET 中单击确认对话框 Selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7063394/