使用 selenium、chromedriver 摆脱 "Chrome is being controlled by automated software"
Getting rid of "Chrome is being controlled by automated software" using selenium, chromedriver
我正在尝试使用一些最推荐的选项来摆脱“Chrome is being controlled..”消息,这里是代码:
def start(self):
options = Options()
options.add_argument('start-maximized')
options.add_argument('disable-infobars')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.binary_location = r'C:\Users\User\Desktop\chromedriver.exe'
self.driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
但是,它显示这个错误
(The process started from chrome location C:\Users\User\Desktop\chromedriver.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
好像 ChromeDriverManager() 没有被视为有效参数,所以我尝试使用 executable_path=ChromeDriverManager()
但仍然不起作用。
options.binary_location = r'C:\Users\User\Desktop\chromedriver.exe'
当您使用 webdriver_manager
调用 Chrome 浏览器时,不需要此行。正如我所见, webdriver_manager
与二进制位置选项冲突。
如果您省略上述行,您的代码应该可以正常工作。
我正在尝试使用一些最推荐的选项来摆脱“Chrome is being controlled..”消息,这里是代码:
def start(self):
options = Options()
options.add_argument('start-maximized')
options.add_argument('disable-infobars')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.binary_location = r'C:\Users\User\Desktop\chromedriver.exe'
self.driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
但是,它显示这个错误
(The process started from chrome location C:\Users\User\Desktop\chromedriver.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
好像 ChromeDriverManager() 没有被视为有效参数,所以我尝试使用 executable_path=ChromeDriverManager()
但仍然不起作用。
options.binary_location = r'C:\Users\User\Desktop\chromedriver.exe'
当您使用 webdriver_manager
调用 Chrome 浏览器时,不需要此行。正如我所见, webdriver_manager
与二进制位置选项冲突。
如果您省略上述行,您的代码应该可以正常工作。