Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

selenium - How do you disable "navigator.webdriver" in chromedriver?

After hours of searching for methods, I was not able to find any ways that would simply work.

The only way I could find was Setting the "pageLoadingStrategy" capability value to "eager", and then immediately executing some javascript so it could change the navigator.webdriver value before the page was rendered. But then you need to change the value after every request and it's not really reliable.

How do you set this before executing any requests? Is there a flag?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After looking at the chrome source code for a good while, I finally figured out what flag needs to be used to disable that navigator.webdriver nuisance.

Here is the flag that needs to be used when starting chromedriver. It completely disables "webdriver=true" from even showing up. :)

--disable-blink-features=AutomationControlled

Also here's some more features that can be enabled/disabled.

Features

Enable Flag:
--enable-blink-features=example1,example2,example3

Disable Flag
--disable-blink-features=example1,example2,example3

Hopefully this helps someone who has also come across this problem. Thanks for looking


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...