WebDriverManager can't locate chrome-for-testing in Linux ARM64

60 Views Asked by At

I want to run Selenium with Chrome on Linux ARM64, using .net 6 program dockerized.

.csproject

<PackageReference Include="Selenium.WebDriver" Version="4.18.1" />
<PackageReference Include="WebDriverManager" Version="2.17.2" />

FooService.cs

new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser, Architecture.X64);
var cService = ChromeDriverService.CreateDefaultService();
_driver = new ChromeDriver(cService, options);

program works fine until Selenium part is triggered.

System.Exception: Unable to locate installed browser for runtime platform Unix
   at WebDriverManager.Helpers.RegistryHelper.GetInstalledBrowserVersionLinux(String[] executableAndArgumentsPairs)
   at WebDriverManager.DriverConfigs.Impl.ChromeConfig.GetRawBrowserVersion()
   at WebDriverManager.DriverConfigs.Impl.ChromeConfig.GetMatchingBrowserVersion()
   at WebDriverManager.DriverManager.GetVersionToDownload(IDriverConfig config, String version)
   at WebDriverManager.DriverManager.SetUpDriver(IDriverConfig config, String version, Architecture architecture)
   at Blabla.Services.Foo.StartChrome() in /src/Bla/FooService.cs:line 46

I installed manually in the container chrome linux64 https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.94/linux64/chrome-linux64.zip

and also tried with chrome mac-arm64 https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.94/mac-arm64/chrome-mac-arm64.zip

curl -L -o chrome-headless-shell.zip "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.22/linux64/chrome-headless-shell-<file>.zip"
unzip chrome-headless-shell.zip -d /opt
rm chrome-headless-shell.zip
export PATH="/opt:${PATH}"

but error remains...

1

There are 1 best solutions below

2
Maria On

I am using Java, but also on Linux

I have the following setup that works perfectly:

private void initChromeDriver() {
        WebDriverManager.chromedriver().setup();
        driver = new ChromeDriver();
    }

....setting needed Chrome options if running on Chrome

But also, my WebDriverManager (bonigarcia) is 5.1.1 WebDriver (selenium-api) - 4.1.2