Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove arguments passed to chrome by selenium / chromedriver

I'm using selenium with python and chromium / chromedriver. I want to REMOVE switches passed to chrome (e.g. --full-memory-crash-report), but so far I could only find out how to add further switches.

My current setup:

from selenium import webdriver
driver = webdriver.Chrome(executable_path="/path/to/chromedriver")
driver.get(someurl)

As far as I understand this can be used to add arguments:

from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--some-switch")
driver = webdriver.Chrome(chrome_options=chrome_options)

So, how do I get rid of default arguments or wipe all default arguments clean and pass only a custom list?

like image 203
user2379007 Avatar asked May 13 '13 19:05

user2379007


1 Answers

It helped me:

options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["test-type"])
options.add_argument("--incognito")
driver = webdriver.Chrome(options=options)

Found solution here https://help.applitools.com/hc/en-us/articles/360007189411--Chrome-is-being-controlled-by-automated-test-software-notification

like image 109
Anton Gorev Avatar answered Sep 20 '22 09:09

Anton Gorev