I'm using Selenium with Python for some camera interface online. The problem is that I can't seem to get Flash activated in Selenium's Chrome.
I find problems close to mine but none of the solutions worked : https://sqa.stackexchange.com/questions/30312/enable-flash-player-on-chrome-62-while-running-selenium-test
None of the parameters I tried changed anything, all I get is the "Get Flash Player" link
Here's my code :
chrome_options = Options()
prefs = {
"profile.default_content_setting_values.plugins" : "1",
"profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-
player" : "1",
"PluginsAllowedForUrls": "ADRESS"
//The player is in a frame, I tried to pass both the host and the framed page
}
chrome_options.add_argument("--disable-web-security")
chrome_options.add_argument("--allow-running-insecure-content")
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
Thank you
I've found a workaround for this problem. First you go to the settings page for the specific URL in chrome. Then you have to press the Tab-Key 25 times to get to the dropdown menu for the flash setting. Press Space to open the dropdown and then press "a" to move to the option "allow", that "a" is because it hasn't worked with the Arrow Keys.
It might not be the nicest solution, but it works for me.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
driver.get("chrome://settings/content/siteDetails?site=https%3A%2F%2Fwww.YOUR-URL.com")
actions = ActionChains(driver)
actions = actions.send_keys(Keys.TAB * 25)
actions = actions.send_keys(Keys.SPACE)
actions = actions.send_keys("a")
actions = actions.send_keys(Keys.ENTER)
actions.perform()
It's a really simple solution, I hope my answer is useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With