Did your Selenium WebDriver ChromeDriver just break? Here's how to fix it.

TL;DR: Add --remote-allow-origins=* to the options for starting ChromeDriver temporarily. Wait for the next release of Selenium (probably 4.8.2) and then remove the option again.

Christian Hujer, CEO / CTO at Nelkinda Software Craft Pvt Ltd
First Published:
by NNelkinda Software Craft Private Limited
Last Modified:
by Christian Hujer
Approximate reading time:
Figure -1: Selenium WebDriver not loading

Selenium Webdriver is a popular tool for testing web applications. Many teams are using it to test their web applications. The most popular Webdriver implementation probably is ChromeDriver.

And if that is your setup, then you might actually face a problem right now. ChromeDriver 111 is not compatible with the default HTTP Client. This means that your Selenium WebDriver tests are not working anymore.

As a workaround, you can add --remote-allow-origins=* to the options for starting ChromeDriver. This will make ChromeDriver work again. But you should remove this option again as soon as possible. The next release of Selenium (probably 4.8.2) will fix this problem.

Here's an example for how this could look like in Kotlin:

class WebDriverProvider {
    @Bean(destroyMethod = "quit")
    fun createDriver(): WebDriver = run {
        val options = ChromeOptions()
        // See
        // See
        // See
        // Remove once Selenium is fixed.
Listing -1: Example Kotlin Spring component for making a WebDriver injectable into JUnit or Cucumber

The key is this line:
This line adds the option to the ChromeDriver. Note that this line is a workaround and should be removed as soon as possible. It is not a good idea to keep this option in your code. And if you can, replace the * with a more specific URL.

Happy Testing!