selenium4中Chrome浏览器显示浏览器受自动化测试软件控制的解决方法
使用chrome浏览器进行自动化测试的过程中,若浏览器出现此提示:
Selenium4解决方法
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
driver = webdriver.Chrome(options=options())
Selenium3解决方法
options.setExperimentalOption("excludeSwitches", ["enable-automation"])
旧版selenium3做法,对selenium4失效,若在Selenium4中运行报错如:
AttributeError: ‘Options’ object has no attribute
‘setExperimentalOption’. Did you mean: ‘_experimental_options’?