selenium: [🐛 Bug]: SessionNotCreatedException with Chromium/Windows after upgrading from 4.8.3 to 4.9.0

What happened?

If I set the platFormName option

chOptions = new ChromeOptions();
chOptions.setCapability(CapabilityType.PLATFORM_NAME, Platform.WINDOWS);
driver.set(new ChromeDriver(chOptions));

It fails for local execution on Chromium based browsers (Chrome/Edge) only on WINDOWS. The same works fine for Linux and MacOS, and the same code works fine on 4.8.3

This is the exception stacktrace

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: No matching capabilities found 
Host info: host: 'MOHAB-MOHIE', ip: '192.168.1.25'
Build info: version: '4.9.0', revision: 'd7057100a6'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '20.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*], extensions: []}, platformName: WINDOWS}]}]
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:94)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:165)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:183)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:158)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
	at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:73)

How can we reproduce the issue?

chOptions = new ChromeOptions();
chOptions.setCapability(CapabilityType.PLATFORM_NAME, Platform.WINDOWS);
driver.set(new ChromeDriver(chOptions));

Relevant log output

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: No matching capabilities found 
Host info: host: 'MOHAB-MOHIE', ip: '192.168.1.25'
Build info: version: '4.9.0', revision: 'd7057100a6'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '20.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*], extensions: []}, platformName: WINDOWS}]}]
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:94)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:165)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:183)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:158)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
	at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:73)

Operating System

Windows 11

Selenium version

Java 4.9.0

What are the browser(s) and version(s) where you see this issue?

Chrome & Edge (Latest)

What are the browser driver(s) and version(s) where you see this issue?

Using SeleniumManager to get the ChromeDriver

Are you using Selenium Grid?

No

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

The workaround until this is fixed, is to send the platformName lowercase.

I spent a while trying to reproduce this and it seems it is Java only. Since we removed completely JWP support, the payload we are sending to the driver is W3C WebDriver only. In Java, the platformName is sent upper case and looks like the driver does not like that. So Platform.WINDOWS ends up as the string WINDOWS, but if we send windows (lowercase), the driver is happy with it.

I will create an issue on ChromeDriver and GeckoDriver for this, but also do something in Selenium Java for it so we do not wait until the driver(s) fix it.

@vicozohili can you please create a separate issue for the headless topic? This will help us to triage things properly.

@diemol in my case it’s clear that it’s working with the same configuration before the upgrade, but failing “only when I specify the platformName” after the upgrade. I implemented a workaround in my test engine to check if the execution address is local to not set the platformName at all and it’s working consistently across all operating systems.