I got a problem when I create my automation project. Firefox is blocking our web app's popup window. I try to enable it from about:preferences#content. But when I run the test firefox still blocking it. I also tried to use setPreference(), but no luck as well. I can't use firefox user profile because eventually, this program will give to all the QA member. Here is the setPreference() code that I tried.
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.
您可以尝试以下方法:
profile.setPreference("browser.popups.showPopupBlocker", false);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.