'chrome binary installed by webdrivermanager is not working

I see in logs that webdrivermanager successfully downloads the chrome binary inside .m2. However, it is still getting picked from some other location.

The same implementation works locally but not in Azure Pipeline.

---------------- 
TEST STARTED: Verify login

[INFO] Running Verify login
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver 
[main] INFO io.github.bonigarcia.wdm.Downloader - Downloading https://chromedriver.storage.googleapis.com/92.0.4515.107/chromedriver_win32.zip 
[main] INFO io.github.bonigarcia.wdm.Downloader - Extracting binary from compressed file chromedriver_win32.zip 
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as C:\Users\vstsagent\.m2\repository\webdriver\chromedriver\win32\92.0.4515.107\chromedriver.exe 

Sep 02, 2021 2:38:10 PM org.openqa.selenium.remote.DesiredCapabilities chrome 
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()` 
[main] INFO net.serenitybdd.core.webdriver.driverproviders.ProvideNewDriver - Instantiating driver 
[main] INFO net.serenitybdd.core.webdriver.driverproviders.ProvideNewDriver - Driver capabilities: Capabilities {acceptInsecureCerts: false, browserName: chrome, chrome.switches: --incognito, --disable-geol..., goog:chromeOptions: {args: [--incognito, --disable-geolocation, --enable-automation, --test-type], extensions: []}, loggingPrefs: org.openqa.selenium.logging..., platform: ANY, version: } 

Starting ChromeDriver 91.0.4472.101 (af52a90bf87030dd1523486a1cd3ae25c5d76c9b-refs/branch-heads/4472@{#1462}) on port 23809 
Only local connections are allowed. 
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. 
ChromeDriver was started successfully. 
[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - 
---------------- 
- TEST FAILED - 
---------------- 

TEST FAILED WITH ERROR: Verify error icon on missing mandatory fields 

--------------------------- 

[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - TEST FAILED AT STEP Given Sample Web page 

[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (unknown error: cannot find Chrome binary 

First para in the logs, you'll see that chrome 93 is installed in .m2 folder and last para first line it is still picking chrome 91. I am not getting how. I have already all chrome instances.

How can I fix this?



Solution 1:[1]

Did you try to keep a version of chromedriver already?

Like this:

// version is your stable version
     WebDriverManager.chromedriver().version(version).setup();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fernando Oliveira