selenium 未启用 chrome 69 上的闪存

Flash on chrome 69 is not enabled by selenium

google chrome 更新到版本 69 后,之前编写的用于在 python 上使用 selenium 启用闪存的代码无法正常工作。如果有人找到它的解决方案,请帮助我和社区

options = Options()
prefs = {
    "profile.default_content_setting_values.plugins": 1,
    "profile.content_settings.plugin_whitelist.adobe-flash-player": 1,
    "profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player": 1,
    "PluginsAllowedForUrls": "URL"
}
options.add_experimental_option("prefs",prefs)

browser = webdriver.Chrome(options=options)

将此参数添加到 chrome_options。

chrome_options.add_argument("--disable-features=EnableEphemeralFlashPermission")

在我的代码中:

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-features=EnableEphemeralFlashPermission")

chrome_prefs = {"profile.default_content_setting_values.plugins": 1,
                "profile.content_settings.plugin_whitelist.adobe-flash-player": 1,
                "profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player": 1,
                "PluginsAllowedForUrls": "BEST URL EVER"}

chrome_options.add_experimental_option("prefs",chrome_prefs)

driver = webdriver.Chrome(chrome_options=chrome_options, service_log_path='NUL')