我正在FireFox中运行Selenium Webdriver测试.单击按钮后,必须出现Javascript(JQuery/Bootstrap)警报,但是无论我如何运行程序(Eclipse,调试模式,可执行Jar),该警报都不会出现.
I'm running a Selenium webdriver test in FireFox. After clicking on a button a Javascript (JQuery/Bootstrap) alert has to appear but no matter how I run the program (eclipse, debug mode, executable Jar) this alert never appears.
当手动执行完全相同的操作时,即使我使用的是由Selenium Webdriver测试启动的相同浏览器会话,也会始终显示警报.我正在Windows 10下使用Selenium Webdriver 2.53 Java 1.7 Firefox 46.0.1.
When executing exactly the same action by hand the alert appears always, even when I used the same browser session that was started up by the Selenium webdriver test. I'm using Selenium Webdriver 2.53 Java 1.7 Firefox 46.0.1 under Windows 10.
任何人都不知道此警报的原因
Anybody an idea why this alert doesn't appear
推荐答案实际上,默认情况下,在Firefox的Selenium Webdriver中,如果显示警告框,则将其关闭.
Actually in Selenium webdriver for Firefox by default the alert box is dismissed if it is appear.
因此,在初始化WebDriver之前,请通过如下设置来修改DesiredCapabilities,以忽略此行为:-
So modify your DesiredCapabilities before initializing WebDriver to ignore this behavior by setting as follows :-
DesiredCapabilities capabilities = DesiredCapabilities.firefox() capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR,"ignore");希望这会对您有所帮助.
Hope this will help you..
更多推荐
运行Selenium Webdriver Test时,没有出现警报
发布评论