gpt4 book ai didi

selenium - 如何使用 webdriver 阻止所有弹出窗口?

转载 作者:行者123 更新时间:2023-12-04 05:16:27 26 4
gpt4 key购买 nike

如何使用 webdriver+java 阻止所有弹出窗口?我知道如何处理弹出窗口,但我根本不想弹出窗口,我想阻止所有弹出窗口,就像浏览器中的弹出窗口阻止程序一样......

最佳答案

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("dom.popup_maximum", 0);
profile.setPreference("privacy.popups.showBrowserMessage", false);
FirefoxDriver fd = new FirefoxDriver(profile);
fd.get("http://example.com");

关于selenium - 如何使用 webdriver 阻止所有弹出窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14201949/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com