I'm developing an application that uses selenium.
- OS: macOS with Apple Silicon
- Language: Kotlin
- JDK: Java 18
But it fails.
Output
Starting ChromeDriver 105.0.5195.19 (b9c217c128c16f53d12f9a02933fcfdec1bf49af-refs/branch-heads/5195@{#176}) on port 50362
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 105
Current browser version is 104.0.5112.79 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'mymac.local', ip: '2400:2200:6f0:7919:347b:3223:3841:9545%en0', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.3', java.version: '18.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)
......
build.gradle.kts
dependencies {
testImplementation(kotlin("test"))
implementation(compose.desktop.currentOs)
// Selenium
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
implementation("org.seleniumhq.selenium:selenium-java:4.4.0")
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver
implementation("org.seleniumhq.selenium:selenium-chrome-driver:4.4.0")
}
Code
fun launch() {
System.setProperty(
"webdriver.chrome.driver",
"/driver/path/chromedriver"
);
ChromeDriver();
}
Chrome driver version 105.0.5195.19 is one of the driver I saved at /driver/path/chromedriver
.
104.0.5112.79 is the version of Chrome I installed on my macOS.
Do I have to use the chromedriver version 104? or is there any way to use one of version 105?
I'm not sure why chrome version on the macOS is needed when I set webdriver.chrome.driver
.
CodePudding user response:
This error message...
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 105
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. google-chrome session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
- You are using chromedriver=105.0
- Release Notes of chromedriver=105.0 clearly mentions the following :
Supports Chrome version 105
- Presumably you are using the latest chrome=104.0
So there is a clear mismatch between chromedriver=105.0 and the chrome=104.0
Solution
Ensure that:
- ChromeDriver is adjusted to ChromeDriver v104.0 level.
Also ensure,
- Chrome Browser is updated to current chrome=104.0 (as per chromedriver=104.0 release notes).
- Selenium is upgraded to current released Version 4.4.0.