Help to capture chrome logs

I need help to capture what the microservices that are seen in the google chrome developer console respond, the truth is I’ve seen a lot of solutions here in the forum, but I can’t understand

Hi,

Can you please share the solutions you find and not understand so that others can help explain if possible?

Im using this forums:

I believe I have written a good enough explanation:

I can’t make it better.

Your problem is a difficult one to solve, which deserves seasoned skill of programming. Katalon doesn’t provide any easier out-of-box solution.

I am afraid that it would be very difficult to write clean codes in Katalon Studio that process Console logs. Katalon’s scripting is not event-driven. There is a fundametal mismatch in the programming model. I think, Katalon does not fit to processing Console logs. You shouldn’t use it.


If you seriously want to process Chrome console.log, and if you are willing to invest your time and effort for learning programming, I would recommend Playright. See the following document of Playright to find how you can process Chrome console.log in Playright.

Playright supports the Chrome DevTools Protocol natively. You would write your test scripts in JavaScript or Typescript in the event-driven fashion with the async and await keywords. In long term (a few years of learning for you, possibly) you would find it far easier, than coding for Chrome console logs in Katalon Studio.

Thank you very much for the answer, really the problem in the end I have in the following line:
image


In fact it performs the installation of the plugin

Here you can find the source of the missing class.

Just copy the source into the Keywords directory of your project.

1 Like

You are without a doubt the best!!! I have no words to thank you

1 Like

I reviewed my previous project and found it does NOT work with the current version of Chrome any longer.

My previous project used Chrome DevTools Protocol Integration plugin, Katalon Store and it failed with Chrome v113. Katalon Store should announce that this plugin no longer works. → @Elly_Tran

See the following.

I am not able to fix this issue because the base layer (com.github.kklisura.cdt) seems not catching up the recent changes in Chrome browser.

So, @juan.ruio, please do not use this sample code.

I wrote a Typescript code in VSCode that listens the console logs of browsers using the Playwright API. It worked fine. No hustle. You can see what I’ve done here.

Notice that precisely this error happened to me with the websocket, but I added the following in the project settings and it worked wonderfully:

What is “remote-allow-origin=*” ?

I wondered what “remote-allow-origin=*” is, so looked for more info.

F.Y.I.

1 Like

Are you asking, or just promoting your solutions?

sure this is comment from me

Hi Kazurayam, does this CDPS able to run in headless mode?

I don’t see what is “CDPS”.
Google told me that CDPS may stands for https://publicsafety.colorado.gov/

No. It does not run any longer, as I wrote in Help to capture chrome logs - #9 by kazurayam

I will show you an evidence. It is 22, Oct 2023. I have

I ran a Test Case SaveWebPageAsMTH/Listen to Console log

It failed:

2023-10-24 21:03:53.102 DEBUG testcase.Listen to Console log           - 3: setViewPortSize(1024, 768)
2023-10-24 21:03:53.276 DEBUG testcase.Listen to Console log           - 4: devToolsService = CdpUtils.getService()
2023-10-24 21:03:54.279 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.katalon.cdp.CdpUtils.getService(CdpUtils.groovy:54)
	at com.katalon.cdp.CdpUtils$getService.call(Unknown Source)
	at Listen to Console log.run(Listen to Console log:33)
	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:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1698149014571.run(TempTestCase1698149014571.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.katalon.cdp.CdpUtils.getService(CdpUtils.groovy:54)
	at com.katalon.cdp.CdpUtils$getService.call(Unknown Source)
	at Script1610443410700.run(Script1610443410700.groovy:33)
	... 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-10-24 21:03:54.312 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.katalon.cdp.CdpUtils.getService(CdpUtils.groovy:54)
	at com.katalon.cdp.CdpUtils$getService.call(Unknown Source)
	at Listen to Console log.run(Listen to Console log:33)
	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:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1698149014571.run(TempTestCase1698149014571.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.katalon.cdp.CdpUtils.getService(CdpUtils.groovy:54)
	at com.katalon.cdp.CdpUtils$getService.call(Unknown Source)
	at Script1610443410700.run(Script1610443410700.groovy:33)
	... 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-10-24 21:03:54.331 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/Listen to Console log

I don’t think I can fix this error. Because the “GitHub - kklisura/chrome-devtools-java-client: Chrome DevTools java client.” project no longer works with the recent versions of Chrome browser (v113). This project seems to be no longer active.

@rices

Do you want to capture chrome console log in Katalon Studio?

I don’t think it is possible in Katalon Studio today.


If you (a Java/Groovy programmer) want to fetch the chrome console log, the best feasible aproach today is Selenium 4 Log feature. See

However Katalon Studio works on top of Selenium 3; it does not work on Selenium 4. Therefore you cannot utilized this feature in Katalon Studio.

Will Katatlon Studio move to Selenium 4 in the near future? — I don’t know. Personally I am negative as I wrote in Selecting / detecting given element from DevTools Network tab? - #16 by kazurayam

If you seriously want to get the Chrome console log in your tests, I would recommend you to choose other tools. If you are OK for JavaScript/Typescript, I would recommend Playwright.

Hi Kazurayam, yes it is still possible with the code you shared here “https://github.com/kazurayam/SaveWebPageAsMHT/blob/master/Keywords/com/kazurayam/cdp/ChromeDevToolsProtocolSupport.groovy… all we need is to add a capability for 'remote-allow-origins=*”.

And regarding to the CDPS => Chrome Dev Protocol Service, that you shared. If it is still going to work in headless mode?

I haven’t tested it.
Please try for yourself.