自动化解决flash插件

一、chrome的解决方式

from selenium import webdriver

from selenium.webdriver.chrome.options import Options
chromeOpitons = Options()
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)

driver = webdriver.Chrome(chrome_options=chromeOpitons)
二、FireFox的实现方式
# 下面代码的作用:以默认配置的方式启动火狐浏览器,同时允许使用flash
p = r"C:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\Profiles\ff920jv6.default"
profile = webdriver.FirefoxProfile(p)
profile.set_preference("plugin.state.flash", 2)
driver = webdriver.Firefox(profile)

猜你喜欢

转载自blog.csdn.net/ying62506799/article/details/80945306
今日推荐