Chrome DevTools Protocol Integration


This is a companion discussion topic for the original entry at https://store.katalon.com/product/144#qa-content

I’m seeing an error in a previously functional test that attempts to set chrome into an ‘offline’ mode using the Katalon provided plugin Chrome DevTools Protocol Integration.

It looks like an update in Chrome has broken this plugin. The tests are failing when calling CdpUtils.getService() and below is my code followed the by the stack trace of the error. Can someone investigate as this is critical functionality for our test suite?

@Keyword
	def goOffline() {
		ChromeDevToolsService cdts = CdpUtils.getService()

		cdts.getNetwork().emulateNetworkConditions(true, 0, 0, 0)

		WebUI.waitForElementVisible(findTestObject('Pages/AuditsV2/T_Offline'), 10)
	}
=============== ROOT CAUSE =====================
Caused by: com.github.kklisura.cdt.services.exceptions.ChromeServiceException: Failed connecting to tab web socket.

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html
================================================

04-06-2023 10:14:56 AM com.radar.katalon.OfflineHelper.goOffline()

Elapsed time: 0.859s

Test Cases/UserJourneys/AuditsV2/GoOffline FAILED.
Reason:
com.kms.katalon.core.exception.StepErrorException: com.github.kklisura.cdt.services.exceptions.ChromeServiceException: Failed connecting to tab web socket.
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.throwError(CustomKeywordDelegatingMetaClass.java:101)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:73)
	at GoOffline.run(GoOffline:34)
	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:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	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 TempTestCase1680772447510.run(TempTestCase1680772447510.groovy:25)
Caused by: 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.katalon.cdp.CdpUtils.getService(CdpUtils.groovy:50)
	at com.katalon.cdp.CdpUtils$getService.call(Unknown Source)
	at com.radar.katalon.OfflineHelper.goOffline(OfflineHelper.groovy:30)
	at com.radar.katalon.OfflineHelper.invokeMethod(OfflineHelper.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:55)
	at Script1669295770096.run(Script1669295770096.groovy:34)
	... 11 more
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)
	... 19 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)
	... 22 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)

Hi, did you ever get a fix for this? I now need to be able to use .getService() now and am getting the same error

I eventually got this working so there isn’t an issue with the plugin. I think I might have gotten it working by adding --remote-allow-origins=* to the args of Chrome. Here is my current setup:

Thanks for the reply. Unfortunately I have already tried this and it didn’t work for me, I still get ‘HandshakeException: Response code was not 101: 403’
I’ll carry on trying other things.

You are right. Chrome v111, which was released at Mar 2023, caused the kklisura/chrome-devtools-java-client does not work any longer. See their issues

This issue is still open, not resolved yet. Their latest release v4.0.0 kklisura/chrome-devtools-java-client was dated at May 2021, which is 2 years ago. They have released no updates since then.

The jar of Katalon’s Chrome DevTools Protocol integration includes the kklisura’s classes that are compiled dated at Nov-2019, possibly of v2.1.0 which is even older.

Therefore the plugin would no longer work with Chrome v111 and newer.

If anybody wants the Chrome DevTools Protocol Integration for Katalon Studio to revive, he/she should contribute to their issue so that the kklisura’s library can work with Chrome v111 and newers.

Once done, he/she can use the kklisura’s library directly. They can bring the upgraded jar into the Drivers folder, and their test case can call the native API of kklisura’s library. He/she does not have to wait for the Katalon’s plugin to be updated.


Selenium 4 has supported Chrome DevTools Protocol.

Therefore, I guess, there would not be many who demands the kklisura’s library any longer.

As far as I am aware, Katalon Studio is not going to move toward Selenium 4.


If you seriously demands Chrome DevTools Protocol for your testings, you should look at Playwright which works on CDP natively.

I think that Katalon Store should announce that the plugin is deprecated. Otherwise more people would get confused.

@vu.tran

There is a fix for it: Enhancing Your Automated Testing with Chrome DevTools in Katalon Studio - Testsmith