Search code examples
pythonseleniumgoogle-chromeflashselenium-chromedriver

Flash on chrome 69 is not enabled by selenium


After google chrome is being updated to version 69, previously written code for enabling the flash using selenium on python is not working. If anyone found out its solution, please help me and the community

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)

Solution

  • Add this argument to chrome_options.

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

    In my code:

    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')