selenium: [π Bug]: [java] Cannot instantiate ChromeDriver on Windows using selenium 4.16
What happened?
I cannot instantiate ChromeDriver on selenium 4.16 on Windows 11.
Note: I was mainly focused to use version 4.16 to get over the bug #13091, which should be resolved by https://github.com/SeleniumHQ/selenium/commit/d1787a9d1ed6a3ea643e9d50f393fec02cc6ae2e . On linux it seems to work correctly, but not on Windows.
How can we reproduce the issue?
Set up a simple maven project. Using just Selenium java.
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.16.0</version>
</dependency>
</dependencies>
with one executable main method:
import org.openqa.selenium.chrome.ChromeDriver;
public class Main {
public static void main(String[] args) {
ChromeDriver chromeDriver = new ChromeDriver();
chromeDriver.quit();
}
}
Relevant log output
Using selenium 4.16 I get following error:
Exception in thread "main" org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}, error Command failed with code: -1073741701, executed: [--browser, chrome, --output, json]
Build info: version: '4.16.0', revision: '15400459dd*'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:25)
at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:13)
at org.openqa.selenium.chrome.ChromeDriver.generateExecutor(ChromeDriver.java:100)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:89)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:73)
at org.example.Main.main(Main.java:8)
Caused by: org.openqa.selenium.WebDriverException: Command failed with code: -1073741701, executed: [--browser, chrome, --output, json]
Build info: version: '4.16.0', revision: '15400459dd*'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:157)
at org.openqa.selenium.manager.SeleniumManager.getDriverPath(SeleniumManager.java:299)
at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:22)
... 6 more
Using selenium 4.15 all works as expected.
Operating System
Windows 11
Selenium version
4.16
What are the browser(s) and version(s) where you see this issue?
Chrome 120
What are the browser driver(s) and version(s) where you see this issue?
from SeleniumManager
Are you using Selenium Grid?
no
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 24 (11 by maintainers)
Possibly related to the change in #13134 I guess
As @nvborisenko and @jstefek realised above (but I didnβt quite follow initially) , installing VC++ redistributable
14.38.33130works - but only if you install the x86 version (even on an x64 system or arm64 system).It looks itβs linked to the x86 version (
i686->x86-> 32-bit) which is possibly where folks are going wrong installing the runtime, and is probably a less common runtime variant to already be installed on folksβ systems for other reasons.Bit of a shame that the extra hidden runtime dependency is needed (especially to
x86arch), but perhaps there are other considerations here.Windows x86? π
Yes.
@bonigarcia Thanks for the clarification. Does it mean, we will have a fix in future versions?
Sorry for the inconvenience. Installing Visual C++ should not be necessary. It seems the Rust flags
-Ctarget-feature=+crt-staticare required to avoid the problem related to Visual C++ Redistributable for Visual Studio 2015-2022. In fact, these flags were already available in former versions of Selenium Manager, but they were not in Selenium 4.15 and 4.16.I created PR #13281 to restore these flags when building Selenium Manager.
If anyone needs the binaries built with that flag, it can be downloaded from here:
https://github.com/SeleniumHQ/selenium/actions/runs/7166910213
@joerg1985 @titusfortner This is what I see: