问题
I am currently using Chrome 75 and I've downloaded the compatible Chromedriver for linux. I've also added it to the PATH variable. However, when I attempt initializing a driver with driver = webdriver.Chrome() I get the following error:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 76
What I get from this message is that my Chromedriver is ment for Chrome version 76, but both my Chromedriver and Chrome browser are version 75.
I even tried deleting the Chromedriver completely from my files and I still get the same error message
回答1:
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 76
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your code trials and the error stack trace would have helped us to debug the issue in a better way. Though you mentioned about compatible Chromedriver for linux but your program while in execution picks up the ChromeDriver v76.0.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
- Release Notes of chromedriver=76.0 clearly mentions the following :
Supports Chrome version 76
Solution
Ensure you have:
- Deleted all the existing different versions of Chromedriver from your system.
- ChromeDriver is updated to current ChromeDriver v76.0 level.
Additionally, ensure you pick up the latest release of ChromeDriver v76.0 i.e. ChromeDriver v76.0.3809.126.
- Chrome is updated to current Chrome Version 76.0 level. (as per ChromeDriver v76.0 release notes)
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Testas non-root user. - Always invoke
driver.quit()withintearDown(){}method to close & destroy the WebDriver and Web Client instances gracefully.
回答2:
This error implement:
You need to download your version of chrome driver:
You can download your version of chrome driver via clicking here:
https://chromedriver.storage.googleapis.com/index.html?path=75.0.3770.140/
来源:https://stackoverflow.com/questions/57600228/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome