只需在Chromeoptions对象中添加一个属性即可解决
1 import time 2 from selenium.webdriver import Chrome, ChromeOptions 3 options = ChromeOptions() 4 # options.headless = True 5 options.add_experimental_option('excludeSwitches', ['enable-automation']) 6 browser = Chrome(r'D:\CentBrowser\CentBrowser\Application\chromedriver.exe', options=options) 7 browser.get('www.baidu.com') 8 browser.save_screenshot('baidu.png') 9 browser.quit()
转载于:https://www.cnblogs.com/zepc007/p/10547140.html