![](/img/trans.png)
[英]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.