Believe in yourself.

最新版Google Chrome 自动加载flash插件的方法

我们在用Selenium做自动化测试时,有时候需要浏览器自动加载flash插件,69以前的谷歌浏览器,可以通过加载属性的方法自动运行flash插件,如下:

prefs={
        "profile.managed_default_content_settings.images":1,
        "profile.content_settings.plugin_whitelist.adobe-flash-player":1,
        "profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player":1,
           }
    chromeOpitons .add_experimental_option('prefs',prefs)

但是69以后的高版本,为了安全性,谷歌禁止了自动加载flash插件,那么怎么办呢?下面介绍一种修改注册表的方法,让浏览器自动加载flash插件

Windows Registry Editor Version 5.00  

[HKEY_CURRENT_USER\SOFTWARE\Policies\Chromium]
"AllowOutdatedPlugins"=dword:00000001 
"RunAllFlashInAllowMode"=dword:00000001 
"DefaultPluginsSetting"=dword:00000001 
"HardwareAccelerationModeEnabled"=dword:00000001 

[HKEY_CURRENT_USER\SOFTWARE\Policies\Chromium\PluginsAllowedForUrls] 
"1"="https://*" 
"2"="http://*" 

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome] 
"AllowOutdatedPlugins"=dword:00000001 
"RunAllFlashInAllowMode"=dword:00000001 
"DefaultPluginsSetting"=dword:00000001 
"HardwareAccelerationModeEnabled"=dword:00000001 

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\PluginsAllowedForUrls] 
"1"="https://*" 
"2"="http://*"

把上面代码拷贝到txt文本中,重命名以.reg结尾的文件,如:chrome自动运行flash.reg,然后双击运行这个文件就行了。

posted @ 2019-04-28 11:10  eastonliu  阅读(6793)  评论(1编辑  收藏  举报