Mor*_*ta1 3 flash google-chrome selenium-chromedriver
我一直在使用它来允许闪存换铬版69.
ChromeOptions options = new ChromeOptions();
// disable ephemeral flash permissions flag
options.addArguments("--disable-features=EnableEphemeralFlashPermission");
Map<String, Object> prefs = new HashMap<>();
// Enable flash for all sites for Chrome 69
prefs.put("profile.content_settings.exceptions.plugins.*,*.setting", 1);
options.setExperimentalOption("prefs", prefs);
nestedDriver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)
现在在版本71的chrome上,此实验性功能(EphemeralFlashPermission)已被删除.
我也试过使用这些设置,但它没有用.
prefs.put("profile.default_content_setting_values.plugins", 1);
prefs.put("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);
prefs.put("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);
Run Code Online (Sandbox Code Playgroud)
现在有没有其他方法可以使用chromedriver启用闪存?
doc*_*rue 10
我还没有找到任何选择,我恐怕永远都找不到.
Windows的解决方法是使用组策略(通过向注册表添加条目):
reg add HKLM\Software\Policies\Google\Chrome /v DefaultPluginsSetting /d 1 /t REG_DWORD /f
reg add HKLM\Software\Policies\Google\Chrome\PluginsAllowedForUrls /v 1 /d http://* /t REG_SZ /f
reg add HKLM\Software\Policies\Google\Chrome\PluginsAllowedForUrls /v 2 /d https://* /t REG_SZ /f
Run Code Online (Sandbox Code Playgroud)
或者只是使用.reg扩展名创建文件并将文本放入其中:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google]
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome]
"DefaultPluginsSetting"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\PluginsAllowedForUrls]
"1"="http://*"
"2"="https://*"
Run Code Online (Sandbox Code Playgroud)
然后保存并双击该文件.
| 归档时间: |
|
| 查看次数: |
7138 次 |
| 最近记录: |