JCode
JCode

Reputation: 48

How can python selenium run on your browser without the automated test software version of the browser?

I just started using selenium. It seems that when the browser opens it runs with Chrome is Being Controlled by Automated Test Software message.

enter image description here

I am trying to automate some tasks within a website when I'm logged into the website. So I need the browser cookie history, etc. Is it possible to do this with selenium? I don't need an incognito type of browser.

Upvotes: 0

Views: 1839

Answers (1)

PDHide
PDHide

Reputation: 19929

If you check the allowed command line arguments for chromium

https://peter.sh/experiments/chromium-command-line-switches/ ,

We see the below flag , this flag is the reason for showing that prompt:

--enable-automation 

but there is no option to disable it

But when you investigate chromium options':

https://chromedriver.chromium.org/capabilities

You can see that we have :

excludeSwitches:

List of Chrome command line switches to exclude that ChromeDriver by default passes when starting Chrome. Do not prefix switches with --.

So the answer is:

options = webdriver.ChromeOptions()
#options.add_argument('--disable-automation')
options.add_experimental_option(
    "excludeSwitches", ['enable-automation'])

driver = webdriver.Chrome(options=options);

Upvotes: 1

Related Questions