chromedriver window.navigator.webdriver flag is true with chrome v80+

前端 未结 1 546
伪装坚强ぢ
伪装坚强ぢ 2021-01-23 11:33

I am using selenium chromeDriver for automated testing. But I cannot \"hide\" the window.navigator.webdriver property. When I open chrome(v64-80.0.3987.100) through

相关标签:
1条回答
  • 2021-01-23 12:11

    The presence of the window.navigator.webdriver property is mandated by the W3C WebDriver Specification. It is both a security feature and a feature to allow better testability of web pages. If you are attempting to automate a page with a WebDriver-powered bot, and you do not own the page being automated, and you are attempting to hide the fact that you’re using a bot from the page’s owners, that is exactly the kind of thing that the property is intended to expose.

    It looks like the developers of Chrome and chromedriver have now closed the security loophole they had allowed in previous versions. I suppose it’s possible you could build your own hacked version of the browser and the driver to not set that property when browsing sites with WebDriver, but that would be the only way.

    As an editorial comment, attempting to hide browsing by a WebDriver-powered bot is most often a fool’s errand. There are multiple ways of detecting such a bot beyond the navigator.webdriver property, and it would be nearly impossible to mask them all. Even if it appeared to work for awhile, eventually, the site in question will come up with more detection mechanisms. Moreover, such activity more than likely violates the Terms of Service of nearly any site one would care to attempt this for. It would be far better to find another mechanism for accomplishing your goal.

    0 讨论(0)
提交回复
热议问题