处理Chrome正受到自动测试软件的控制的提示

现象:

 

 

 代码:

# coding=utf-8
from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://www.so.com/")
driver.maximize_window()

 

解决方案:在浏览器配置里添加参数

chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
#调用浏览器
driver = webdriver.Chrome(options=chrome_options)

 

具体代码:

# coding=utf-8
from selenium import webdriver
chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
driver
= webdriver.Chrome(options=chrome_options) driver.get("https://www.so.com/") driver.maximize_window()

运行后就不显示提示了:

 

posted on 2021-08-19 17:25  bug无处不在  阅读(400)  评论(0编辑  收藏  举报