[英]How to click on allow button on popup window in selenium Webdriver by using Java
[英]Java-Selenium Allow Popup Window
创建自动化项目时遇到问题。 Firefox阻止了我们Web应用程序的弹出窗口。 我尝试从about:preferences#content启用它。 但是,当我运行测试Firefox时,仍将其阻止。 我也尝试使用setPreference(),但也没有运气。 我无法使用firefox用户个人资料,因为最终,该程序将提供给所有QA成员。 这是我尝试过的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");
非常感谢你。
您可以尝试以下方法:
profile.setPreference("browser.popups.showPopupBlocker", false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.