[英]Java-Selenium Allow Popup Window
I got a problem when I create my automation project. 创建自动化项目时遇到问题。 Firefox is blocking our web app's popup window.
Firefox阻止了我们Web应用程序的弹出窗口。 I try to enable it from about:preferences#content.
我尝试从about:preferences#content启用它。 But when I run the test firefox still blocking it.
但是,当我运行测试Firefox时,仍将其阻止。 I also tried to use setPreference(), but no luck as well.
我也尝试使用setPreference(),但也没有运气。 I can't use firefox user profile because eventually, this program will give to all the QA member.
我无法使用firefox用户个人资料,因为最终,该程序将提供给所有QA成员。 Here is the setPreference() code that I tried.
这是我尝试过的setPreference()代码。
public void LoginCad(){
//System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
System.setProperty("webdriver.gecko.driver", "C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("dom.disable_open_during_load", false);
profile.setPreference("privacy.popups.disable_from_plugins", 0);
profile.setPreference("privacy.popups.policy", 1);
profile.setPreference("dom.max_script_run_time", "999");
driver = new FirefoxDriver(profile);
driver.get("http://172.16.1.133:8090/CADENCIE/servlet/app");
Thank you very much. 非常感谢你。
You can try this: 您可以尝试以下方法:
您可以尝试以下方法:
profile.setPreference("browser.popups.showPopupBlocker", false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.