如何使用SeleniumWebDriver和Java处理firefox插件的允许弹出
同时自动网页,其中包括视频网络播放器插件。 如果导航到视频页面,将显示允许弹出窗口。 我已经尝试使用下面的代码来处理允许弹出窗口。但它不起作用 下面是我使用的代码如何使用SeleniumWebDriver和Java处理firefox插件的允许弹出,java,selenium,Java,Selenium,同时自动网页,其中包括视频网络播放器插件。 如果导航到视频页面,将显示允许弹出窗口。 我已经尝试使用下面的代码来处理允许弹出窗口。但它不起作用 下面是我使用的代码 FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("security.mixed_content.block_active_content", true); profile.setPreference("security.mixed_content
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("security.mixed_content.block_active_content", true);
profile.setPreference("security.mixed_content.block_display_content", false);
WebDriver driver = new FirefoxDriver(profile);
有人能帮忙吗
提前感谢。参考答案,您可能需要为扩展名找到文件源并使用以下选项:
File file = new File("path to extension file");
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(file);
WebDriver driver = new FirefoxDriver(profile);
这个偏好如何:
FirefoxProfile profile= new FirefoxProfile();
profile.setPreference(“browser.popups.showPopupBlocker”, false);
WebDriver driver = new FirefoxDriver(profile);
尝试设置此首选项以摆脱“允许”/“继续阻止”: 此外,您可能需要使用此选项来自动允许扩展
profile.setPreference("extensions.blocklist.enabled", false);
是否要隐藏此弹出窗口或允许自动使用插件或其他内容?
profile.setPreference("extensions.blocklist.enabled", false);