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?
I believe I have written a good enough explanation:
I can’t make it better.
juan.rubio:
but I can’t understand
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:
In fact it performs the installation of the plugin
Here you can find the source of the missing class.
package com.kazurayam.cdp
import org.openqa.selenium.HasCapabilities
import org.openqa.selenium.WebDriver
import com.github.kklisura.cdt.services.ChromeDevToolsService
import com.github.kklisura.cdt.services.ChromeService
import com.github.kklisura.cdt.services.impl.ChromeServiceImpl
import com.github.kklisura.cdt.services.types.ChromeTab
/**
* A set of helper methods for a E2E test in Java to activate com.github.kklisura.cdt.services.ChromeDevToolsSerivce
* which enables the test to save the MIME HTML file of a web page rendered on a Chrome browser. It is assumed that
* the browser has been opened by Selenium WebDriver.
*
* The original is written by Katalon, hosted at
* https://github.com/katalon-studio/katalon-studio-chrome-devtools-protocol-plugin/blob/master/Include/scripts/groovy/com/katalon/cdp/CdpUtils.groovy
* but I modified it to make it independent on the Katalon API
*
* @author kazuakiurayama
This file has been truncated. show original
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.
opened 11:26PM - 16 May 23 UTC
using the version 0.2.0 of this project, I tried to run "Test Cases/Listen to Co… nsole 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
```
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.
opened 04:59PM - 08 Mar 23 UTC
closed 02:30PM - 16 Mar 23 UTC
C-java
I-defect
### What happened?
After the Chrome 111 update, you can no longer kick off a ch… romedriver instance unless you add an additional chrome option:
"--remote-allow-origins=*"
I submitted a bug with Google and they responded, and indicated this has to do with Selenium setting the origin header:
https://bugs.chromium.org/p/chromium/issues/detail?id=1422444
### How can we reproduce the issue?
```shell
Just update to chrome 111, and try and run a UI selenium test.
I am using Java and Junit. See the link to the Chrome ticket for more details on how I was personally starting the driver.
```
### Relevant log output
```shell
Mar 07, 2023 8:18:50 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNING: Invalid Status code=403 text=Forbidden
java.io.IOException: Invalid Status code=403 text=Forbidden
at org.asynchttpclient.netty.handler.WebSocketHandler.abort(WebSocketHandler.java:92)
at org.asynchttpclient.netty.handler.WebSocketHandler.handleRead(WebSocketHandler.java:118)
at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:64820/devtools/browser/27cc1ab2-7320-47bf-b503-1099b7052fcc
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'sdg-mac334.local', ip: '2601:681:8004:57a0:0:0:0:5bfc%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.1', java.version: '17.0.4.1'
Driver info: driver.version: Driver
```
### Operating System
Mac OS Monterey
### Selenium version
4.4.0
### What are the browser(s) and version(s) where you see this issue?
Chrome 111
### What are the browser driver(s) and version(s) where you see this issue?
I'm using webdriver manager, so whichever the latest one its grabbing.
### Are you using Selenium Grid?
_No response_
1 Like
bionel
May 17, 2023, 3:00pm
13
Are you asking, or just promoting your solutions?
sure this is comment from me