Reputation: 117
I am trying to set multiple chrome options in my chrome browser. This is what I currently have:
prefs = {"download.default_directory" : "Download/Path"}
moreprefs = {'safebrowsing.enabled': 'false'}
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option("prefs", prefs)
chromeOptions.add_experimental_option("prefs", moreprefs)
self.driver = webdriver.Chrome(chrome_options=chromeOptions)
The probblem is it only takes in to account the 1 of the chromeOptions.add_experimental and I need both
Upvotes: 1
Views: 2807
Reputation: 11
try this:
prefs = {"download.default_directory": "your_dir", 'safebrowsing.enabled': True}
chromeOptions.add_experimental_option("prefs", prefs)
Upvotes: 1
Reputation: 12970
update the prefs dictionary. and then set the preference.
prefs = {"download.default_directory" : "Download/Path"}
moreprefs = {'safebrowsing.enabled': 'false'}
chromeOptions = webdriver.ChromeOptions()
prefs.update(moreprefs)
chromeOptions.add_experimental_option("prefs", prefs)
self.driver = webdriver.Chrome(chrome_options=chromeOptions)
Upvotes: 2