How do I stay ahead with the latest WebDriver version on Selenium

Since the browser update yesterday my test won’t start and I get the message:

There was an error creating WebDriver object for Chrome

I use Selenium Jupiter with the @TestTemplate and my browsers.json looks:

{
  "browsers": [
    [
      {
        "type": "chrome",
        "version": "latest"
      }
    ]
  ]
}

Here my dependencies:

    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
      <version>4.14.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.github.bonigarcia</groupId>
      <artifactId>webdrivermanager</artifactId>
      <version>5.5.3</version>
    </dependency>
    <dependency>
      <groupId>io.github.bonigarcia</groupId>
      <artifactId>selenium-jupiter</artifactId>
      <version>4.3.7</version>
      <scope>test</scope>
    </dependency>

I thought that the webdrivermanager would solve that version issues.
My experience with Selenium is not so huge, because I use that only for a few weeks.

Is there a solution to keep up with the latest browser versions?

>Solution :

You’re using WebDriverManager, which should generally handle the browser-driver compatibility. But sometimes issues still occur, especially after browser updates. Here are some debugging and resolution steps:

  1. Check Chrome Version: Make sure your local Chrome version matches with the ChromeDriver being downloaded. If not, update Chrome.

  2. Force Update WebDriverManager: Before initializing WebDriver, call:

    WebDriverManager.chromedriver().forceDownload().setup();
    

    This will force WebDriverManager to download the latest version.

  3. Logs: Look at WebDriverManager logs to identify what’s being downloaded. You can enable logging by adding the following to your log4j.properties or equivalent:

    log4j.logger.io.github.bonigarcia=DEBUG
    
  4. Manual Download: As a last resort, manually download the compatible ChromeDriver and set its path:

    System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
    
  5. Dependencies: Update WebDriverManager and Selenium-Jupiter to their latest versions in your pom.xml.

If you’ve tried all of these and the issue persists, it might be a bug and reporting it would be beneficial.

Remember, if you’re running tests in a CI/CD environment, make sure to update Chrome and ChromeDriver there as well.

Leave a Reply