无法在Windows 10中打开Chrome Web驱动程序



我想将chrome-webdriver与python和selenium库一起使用;然而,我在python控制台中打开web驱动程序时遇到了问题。它正在寻找路径,它打开了一个看起来像浏览器的东西,它还启动了一个在端口####上侦听的服务,但当我进行时

driver.get('http://www.google.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'driver' is not defined

它不起作用。。。这是我打开网站时遇到的错误

这是打开网络驱动程序的输出

driver = webdriver.Chrome('C:chromedriverchromedriver.exe')
DevTools listening on ws://127.0.0.1:52968/devtools/browser/b7b88ebb-e9e1-4726-9d4e-4e3f13990a0a       Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:UsersGeorgeAppDataLocalProgramsPythonPython38-32libsite-packagesseleniumwebdriverchromewebdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "C:UsersGeorgeAppDataLocalProgramsPythonPython38-32libsite-packagesseleniumwebdriverremotewebdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:UsersGeorgeAppDataLocalProgramsPythonPython38-32libsite-packagesseleniumwebdriverremotewebdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:UsersGeorgeAppDataLocalProgramsPythonPython38-32libsite-packagesseleniumwebdriverremotewebdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:UsersGeorgeAppDataLocalProgramsPythonPython38-32libsite-packagesseleniumwebdriverremoteerrorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81

您需要chromedriver.exe来匹配当前chrome浏览器的版本。要检查您的chrome版本,请进入chrome设置并选择about chrome选项卡。您可以在那里找到您的chrom版本。然后从这里下载与您的版本相匹配的chromedriver。将代码中的路径更新为此驱动程序,它应该可以工作。

相关内容

  • 没有找到相关文章

最新更新