0

After updating Google Chrome and Selenium, tests are not running with ChromeDriver.

System:

OS: Ubuntu 20.04.5 LTS
Selenium: selenium-server-4.8.1.jar
Chrome: Version 111.0.5563.64 (Official Build) (64-bit)
Java: 
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09)
OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)

Code:

public static void main(String[] args) {
  // Set up browser
  ChromeDriver driver = new ChromeDriver();
  driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
  driver.get("https://www.example.com");
  driver.manage().window().maximize();
}

        

Error:

org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:44211/devtools/browser/34525f00-d1ba-4249-9fc0-904e3b8be194
Build info: version: '4.8.1', revision: '8ebccac989'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-67-generic', java.version: '17.0.5'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:102)
    at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:128)
    at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:107)
    at org.openqa.selenium.devtools.Connection.<init>(Connection.java:78)
    at org.openqa.selenium.chromium.ChromiumDriver.lambda$new$2(ChromiumDriver.java:116)
    at java.base/java.util.Optional.map(Optional.java:260)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:50)
    at TTR.TicketReportWeekly.main(TicketReportWeekly.java:33)

Can anyone help me understand this error and also resolve it?

4 Answers 4

2
ChromeOptions ops = new ChromeOptions();
ops.addArguments("--remote-allow-origins=*");
ChromeDriver driver = new ChromeDriver(ops);

This Script sorted my issue. Thanks a lot!

2
  • Welcome to the community. First, it's not so great to start off with "Great Bro." This can come across as arrogant and sexist, as there are a lot of women in this group. So, I'd recommend removing that. Second, can you expand on your answer and explain why this is a good solution? Explaining why helps others learn.
    – Lee Jensen
    Commented Mar 14, 2023 at 15:37
  • Balasubramani, now you should have enough points to comment. So please move this to the comment. Lee Jensen, once this is moved to the comment on the right answer, I wouldn't be offended with the Bro. I do understand the concern of it in an answer. Commented Mar 15, 2023 at 2:17
0

Download the chrome-driver from the selenium.dev as per your chrome version. When the chromedriver and chrome browser version doesn't match script won't run.

1
  • Thanks. I already did that. The version of Selenium standalone server mentioned in the question description was downloaded today from the official Selenium website. Commented Mar 10, 2023 at 10:07
0

I have been associated with a software qa consulting firm for more than nine years, and it is one of the challenges frequently faced by the automation team during the initial days.

Usually, this automation test stops running on the updated Google Chrome due to an incompatible Driver version. Hence, we need to ensure that 'Chromedriver' is always upgraded to the compatible version with the installed 'Google Chrome' version on the system/servers.

0

From 4.8.* selenium version you need not add ops.addArguments("--remote-allow-origins=");. Its working fine for me without that. I added "com.google.guava guava 31.0.1-jre" dependency in POM.XML when I changed from selenium 3. version to 4.8.* version. It working for me.

If anyone upgrading from selenium3.* to 4.* follow the document link "https://www.selenium.dev/documentation/webdriver/getting_started/upgrade_to_selenium_4/" helped a lot for me

After chrome browser version changed from 115 to 116 selenium 4.8.* version was no longer working. then shifting to 4.11.0 version it started working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.