Aaron
Aaron

Reputation: 99

Enable Flash with Chromedriver in Python

Trying to enable Adobe Flash Player in chromedriver using python. I've gone through a number of attempts including:

prefs = {'plugins.plugins_enabled': 'Adobe Flash Player'}

prefs = {'plugins.plugins_list' : [{'enabled':True,'name':'Adobe Flash 
Player'}]}

prefs = {
    'profile.default_content_setting_values.plugins': 1,
    'profile.content_settings.plugin_whitelist.adobe-flash-player': 1
}

along with a few other variations that I found from the top google results regarding this issue.

Upvotes: 2

Views: 5634

Answers (2)

Shuvayan
Shuvayan

Reputation: 33

Below is the complete solution starting from import.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

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": "ENTER THE URL HERE"
}

options.add_experimental_option("prefs",prefs)
browser = webdriver.Chrome(options=options)

Upvotes: 1

Aaron
Aaron

Reputation: 99

Ended up solving this with the following code:

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": "https://url.com"
}

options.add_experimental_option("prefs",prefs)

Upvotes: 4

Related Questions