Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用SeleniumWebDriver和Java处理firefox插件的允许弹出_Java_Selenium - Fatal编程技术网

如何使用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);