I have two different automation frameworks that both make use of the Chrome driver. These frameworks do not exactly directly access Selenium (they are Appian based) but I have suddenly (beginning today) found that none of my tests work and I get the same error every time. I am sure that the driver is up to date.
org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:50576/devtools/browser/12acb1c1-5b1c-46c2-7501-a8958019eb0f
To give a little bit of context the Appian framework handles the Selenium driver in a back-end class/method that I have no control over known as "CucumberBaseFixture."
Within my Cucumber step definitions I simply call the driver like such
Given I setup with "CHROME" browser
as Appian has already created all of the step definitions within their automation framework jar.
Further, I actually set the URL directly using another pre-configured step as such (I have redacted the exact URL due to corporate security.
And I set Appian URL to "REDACTED BUT 100% VALID URL"
I have verified that my necessary configuration is correct for the driver which is not difficult considering they have a script that sets the configuration parameter for you.
Once I execute the test then I get the following stack as well which I find interesting and then the chrome window opens for a moment, closes and the test ends.
ChromeDriver was started successfully.
Mar 13, 2023 4:22:09 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Mar 13, 2023 4:22:09 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNING: Invalid Status code=403 text=Forbidden
Thank you for any help.
After a very long investigation including opening a ticket with the link Daniel shared and then looking into a still unresolved Selenium bug, I was able to locate a comment with the current workaround.
First, you must declare the following in your POM:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<version>4.8.1</version>
<artifactId>selenium-http-jdk-client</artifactId>
</dependency>
Second, you must add the following line of code to your framework. I put mine in my Junit @BeforeClass in my Cucumber TestRunner:
System.setProperty("webdriver.http.factory", "jdk-http-client");
I hope this helps anyone with similar problems.