其他分享
首页 > 其他分享> > Selenium隐藏“Chrome is being controlled by automated test software”

Selenium隐藏“Chrome is being controlled by automated test software”

作者:互联网

隐藏“Chrome is being controlled by automated test software”

如果你去查了别的答案了,相信你得到的解决方法肯定是这样的:

# 这是错误示例,高版本Chrome请不要使用这个方法:
# Options中添加一个argument即可!
options.add_argument("disable-infobars")

这个argument其实很早就已经被弃用了,
你在Chrome 78版本上,用这个是不能解决问题的

那么其实应该怎么解决呢,如下:

# Chrome 78 with Chromedriver 78 Works fine!
options.add_experimental_option("excludeSwitches", ["enable-automation"])

隐藏“disable developer mode extensions”

直接上代码吧:

options.add_experimental_option('useAutomationExtension', False)

隐藏“Save password”弹窗

options.add_experimental_option("prefs", {"profile.password_manager_enabled": False, "credentials_enable_service": False})

最后,相关资料地址如下:

Chromedriver版本对应关系及下载: https://chromedriver.chromium.org/downloads
老版本Chromedriver汇总下载: https://chromedriver.storage.googleapis.com/index.html
Capabilities&ChromeOptions: https://sites.google.com/a/chromium.org/chromedriver/capabilities

最后想说一句,软件代码迭代速度太快,需要对应的环境处理对应的问题

转自:https://zhuanlan.zhihu.com/p/89451454

标签:controlled,Chrome,Selenium,Chromedriver,add,https,False,options
来源: https://blog.csdn.net/weixin_42107267/article/details/121557303