[英]SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 87 using ChromeDriver and Chrome
I am trying to get selenium to open a site and I don't really have any errors in my PyCharm editor but when I run my code I am getting a lot of errors I do not really understand it would be nice to get some help我正在尝试让 selenium 打开一个站点,但我的 PyCharm 编辑器中并没有任何错误,但是当我运行我的代码时,我遇到了很多错误,我不太明白,如果能得到一些帮助会很好
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe")
driver.get("https://www.singaporetech.edu.sg/") # get gets url
print(driver.title) # title of the page
driver.close()
This is the error I get:这是我得到的错误:
C:\Users\kaush\PycharmProjects\seleniumTest1\venv\Scripts\python.exe C:/Users/kaush/PycharmProjects/seleniumTest1/main.py
Traceback (most recent call last):
File "C:\Users\kaush\PycharmProjects\seleniumTest1\main.py", line 4, in <module>
driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe")
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.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 87
Current browser version is 86.0.4240.198 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
This error message...这个错误信息...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 87
Current browser version is 86.0.4240.198 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context ie Chrome Browser session. ...暗示ChromeDriver无法启动/生成新的浏览上下文,即Chrome 浏览器会话。
Your main issue is the incompatibility between the version of the binaries you are using as follows:您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:
Supports Chrome version 87支持Chrome 87 版
So there is a clear mismatch between ChromeDriver v2.40 and the Chrome Browser v85.0所以ChromeDriver v2.40和Chrome 浏览器 v85.0之间存在明显的不匹配
Ensure that:确保这件事:
@Test
as non-root user.以非 root用户身份执行@Test
。driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.始终在tearDown(){}
方法中调用driver.quit()
以优雅地关闭和销毁WebDriver和Web Client实例。I am trying to get selenium to open a site and I don't really have any errors in my PyCharm editor but when I run my code I am getting a lot of errors I do not really understand it would be nice to get some help我试图用硒打开一个网站,而我的PyCharm编辑器中确实没有任何错误,但是当我运行代码时,我遇到了很多错误,我不太了解获得帮助会很不错。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe")
driver.get("https://www.singaporetech.edu.sg/") # get gets url
print(driver.title) # title of the page
driver.close()
This is the error I get:这是我得到的错误:
C:\Users\kaush\PycharmProjects\seleniumTest1\venv\Scripts\python.exe C:/Users/kaush/PycharmProjects/seleniumTest1/main.py
Traceback (most recent call last):
File "C:\Users\kaush\PycharmProjects\seleniumTest1\main.py", line 4, in <module>
driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe")
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.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 87
Current browser version is 86.0.4240.198 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.