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('./chromedriver', chrome_options=chromeOpitons)
Firefox
option = webdriver.FirefoxProfile()
option.set_preference("plugin.state.flash", 2)
driver = webdriver.Firefox(option)
网友评论