0

I'm working on Python with Selenium.

I figured out how to run Chrome with an extension, the only downside is that the extension has settings and these are always blank when starting an automated Chrome session.

Where or how do I save settings when running a crx file? I tried looking in all the files within the extension folder but I did not find my currents settings in them.. Are they maybe stored in the profile?

Below the code I'm using to open the chrome driver with extension.

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


executable_path = "/webdrivers"
os.environ["webdriver.chrome.driver"] = executable_path

chrome_options = Options()
chrome_options.add_extension('/webdrivers/extension_3_1_0_0.crx')

driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get("http://stackoverflow.com")

I don't want to configure these settings every time I start a sessions. How can I let these settings stick?

Thanks in advance!

Romano
  • 619
  • 6
  • 12

1 Answers1

0

I already fixed it myself by loading the profile with the chrome driver.

options = Options()
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=DIRECTORYTOPROFILEFOLDERWITHINAPPDATA")

Case closed.

Romano
  • 619
  • 6
  • 12