"Test Cases/Listen to Console log" failed due to "com.github.kklisura.cdt.services.exceptions.ChromeServiceException: Failed connecting to tab web socket."
kazurayam opened this issue · 7 comments
using the version 0.2.0 of this project, I tried to run "Test Cases/Listen to Console log", I got the following error.
2023-05-17 08:08:08.829 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2023-05-17 08:08:08.833 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Listen to Console log
2023-05-17 08:08:10.160 DEBUG testcase.Listen to Console log - 1: gson = setPrettyPrinting().create()
2023-05-17 08:08:10.188 DEBUG testcase.Listen to Console log - 2: openBrowser("")
2023-05-17 08:08:10.571 INFO c.k.k.core.webui.driver.DriverFactory - Starting 'Chrome' driver
5 17, 2023 8:08:10 午前 org.openqa.selenium.remote.DesiredCapabilities chrome
情報: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
2023-05-17 08:08:10.628 INFO c.k.k.core.webui.driver.DriverFactory - Action delay is set to 0 milliseconds
Starting ChromeDriver 113.0.5672.24 (65f30d4e8051264233c679c7cd3743679f15339d-refs/branch-heads/5672@{#243}) on port 39121
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
5 17, 2023 8:08:14 午前 org.openqa.selenium.remote.ProtocolHandshake createSession
情報: Detected dialect: W3C
2023-05-17 08:08:14.262 INFO c.k.k.core.webui.driver.DriverFactory - sessionId = 21e97dd2d239382db08abf32b228ce0f
2023-05-17 08:08:14.289 INFO c.k.k.core.webui.driver.DriverFactory - browser = Chrome 113.0.0.0
2023-05-17 08:08:14.290 INFO c.k.k.core.webui.driver.DriverFactory - platform = Mac OS X
2023-05-17 08:08:14.291 INFO c.k.k.core.webui.driver.DriverFactory - seleniumVersion = 3.141.59
2023-05-17 08:08:14.294 INFO c.k.k.core.webui.driver.DriverFactory - proxyInformation = ProxyInformation { proxyOption=NO_PROXY, proxyServerType=HTTP, username=, password=********, proxyServerAddress=, proxyServerPort=0, executionList="", isApplyToDesiredCapabilities=true }
2023-05-17 08:08:14.316 DEBUG testcase.Listen to Console log - 3: setViewPortSize(1024, 768)
2023-05-17 08:08:14.477 DEBUG testcase.Listen to Console log - 4: driver = getWebDriver()
2023-05-17 08:08:14.506 DEBUG testcase.Listen to Console log - 5: devToolsService = ChromeDevToolsProtocolSupport.getService(driver)
2023-05-17 08:08:15.554 ERROR c.k.katalon.core.main.TestCaseExecutor - ❌ Test Cases/Listen to Console log FAILED.
Reason:
com.github.kklisura.cdt.services.exceptions.ChromeServiceException: Failed connecting to tab web socket.
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:206)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:161)
at com.github.kklisura.cdt.services.ChromeService$createDevToolsService$0.call(Unknown Source)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport.getService(ChromeDevToolsProtocolSupport.groovy:49)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport$getService.call(Unknown Source)
at Listen to Console log.run(Listen to Console log:36)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:445)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:436)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:415)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:407)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:284)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1684278484712.run(TempTestCase1684278484712.groovy:25)
Caused by: com.github.kklisura.cdt.services.exceptions.WebSocketServiceException: Failed connecting to ws server {}
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.connect(WebSocketServiceImpl.java:120)
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.create(WebSocketServiceImpl.java:86)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.lambda$new$0(ChromeServiceImpl.java:94)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:176)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:161)
at com.github.kklisura.cdt.services.ChromeService$createDevToolsService$0.call(Unknown Source)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport.getService(ChromeDevToolsProtocolSupport.groovy:49)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport$getService.call(Unknown Source)
at Script1610443410700.run(Script1610443410700.groovy:36)
... 11 more
Caused by: javax.websocket.DeploymentException: Handshake error.
at org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:679)
at org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:717)
at org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:871)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:516)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:378)
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.connect(WebSocketServiceImpl.java:98)
... 19 more
Caused by: org.glassfish.tyrus.core.HandshakeException: Response code was not 101: 403.
at org.glassfish.tyrus.client.TyrusClientEngine.processResponse(TyrusClientEngine.java:320)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleHandshake(GrizzlyClientFilter.java:346)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:315)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
2023-05-17 08:08:15.579 ERROR c.k.katalon.core.main.TestCaseExecutor - ❌ Test Cases/Listen to Console log FAILED.
Reason:
com.github.kklisura.cdt.services.exceptions.ChromeServiceException: Failed connecting to tab web socket.
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:206)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:161)
at com.github.kklisura.cdt.services.ChromeService$createDevToolsService$0.call(Unknown Source)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport.getService(ChromeDevToolsProtocolSupport.groovy:49)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport$getService.call(Unknown Source)
at Listen to Console log.run(Listen to Console log:36)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:445)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:436)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:415)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:407)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:284)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1684278484712.run(TempTestCase1684278484712.groovy:25)
Caused by: com.github.kklisura.cdt.services.exceptions.WebSocketServiceException: Failed connecting to ws server {}
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.connect(WebSocketServiceImpl.java:120)
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.create(WebSocketServiceImpl.java:86)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.lambda$new$0(ChromeServiceImpl.java:94)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:176)
at com.github.kklisura.cdt.services.impl.ChromeServiceImpl.createDevToolsService(ChromeServiceImpl.java:161)
at com.github.kklisura.cdt.services.ChromeService$createDevToolsService$0.call(Unknown Source)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport.getService(ChromeDevToolsProtocolSupport.groovy:49)
at com.kazurayam.cdp.ChromeDevToolsProtocolSupport$getService.call(Unknown Source)
at Script1610443410700.run(Script1610443410700.groovy:36)
... 11 more
Caused by: javax.websocket.DeploymentException: Handshake error.
at org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:679)
at org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:717)
at org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:871)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:516)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:378)
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.connect(WebSocketServiceImpl.java:98)
... 19 more
Caused by: org.glassfish.tyrus.core.HandshakeException: Response code was not 101: 403.
at org.glassfish.tyrus.client.TyrusClientEngine.processResponse(TyrusClientEngine.java:320)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleHandshake(GrizzlyClientFilter.java:346)
at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:315)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
2023-05-17 08:08:15.644 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Listen to Console log
In the issues list of the kklisura's project, I found a similar issue:
kklisura/chrome-devtools-java-client#71
In their post, I was interested to find a message:
[0926/110742.491845:ERROR:devtools_http_handler.cc(636)] Using unsafe HTTP verb GET to invoke /json/new. This action will stop supporting GET and POST verbs in future versions.
There seems to be a problem in between Chrome browser and the kklisura's code.
According to the Git log of this repository, the Test Case worked at 6th Oct 2021. It's a year and half ago. Old enough!
The version my Chrome browser is 113.0.5672.92 currently.
The Katlaon's plugin uses v2.1.0 of kklisura's library
https://github.com/kklisura/chrome-devtools-java-client/releases/tag/v2.1.0
I guess that, since Oct 2021, Chrome browser has changed itself somehow, which caused my script (including the kklisura's code) to fail.
I don't think I can debug the kklisura's code.
I will leave this issue ...
Related to "unsafe HTTP verb GET to invoke /json/new" issue, I found the following post
This implies that com.github.kklisura.cdt
library requires a similar change for fix
What needs to be done to fix the "unsafe HTTP verb GET to invoke /json/new" issue in the com.github.kklisura.cdt
library?
I had a look at the source code.
I found that it uses org.glassfish.tyrus.container.grizzly/client/GrizzlyClientContainer class to drive a WebSocket connection.
Which version of the tyrus jar is used?
https://github.com/kklisura/chrome-devtools-java-client/blob/master/cdt-java-client/pom.xml
<tyrus.version>1.13.1</tyrus.version>
...
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-client</artifactId>
<version>${tyrus.version}</version>
</dependency>
Is the version 1.13.1 of the tyrus library up-to-date?
https://mvnrepository.com/artifact/org.glassfish.tyrus/tyrus-container-grizzly-client
No. v1.13.1 of tyrus is very old.
I am afraid that the v1.13.1 of the tyrus library can not cope with the current version of browsers; never it can.
So the kklisura's chrome devtools java client library needs a great overhauling. It needs to upgrade external dependences, especially Tyrus Grizzly Client Container, to cope with the current version of browsers.
This is a difficult task. I am not capable of overhauling the kklisura's chrome devtools java client library.
I am not willing to be involved in overhauling the kklisura's chrome devtools java client library.
Rather I would try using Playwright to write a code in Typescript to listen to Console log of Chrome browser. Possibly it will work no problem.