其他分享
首页 > 其他分享> > 处理Chrome正受到自动测试软件的控制的提示

处理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()

运行后就不显示提示了:

 

标签:webdriver,www,Chrome,自动测试,driver,chrome,软件,options
来源: https://www.cnblogs.com/bugbreak/p/15162860.html