See XHR in console

Hi all… Anyone have any idea how to see the body of a Request in the console of katalon?. When i do actions in the ui i need to see the body for all request.

I know you can watch the HAR stuff going out - not sure about browser-based XHR stuff. I suspect you can’t do that from webdriver… Maybe these guys have an idea: @Brandon_Hein @kazurayam @ThanhTo

You can certainly watch the traffic in the DevTools - but that’s not what you’re asking for :confused:

Not sure, I’ve never had this requirement. I can tell you though that Katalon will not have built-in functionality to support this.

One thing that you might be able to use: BrowserMob Proxy. I’ve used this to inject custom header data into each request, so it’s possible they have libs to record traffic as well.

@Russ_Thomas @Brandon_Hein Thanks for the answers. Use the ChromeDevTools plugin. It allowed me to visualize in console each type of HTTP request that is generated. What I can’t do is get the body of the requests. Will you have an idea how to do it?

In devtools, you can see request/result bodies as well, no problem. I thought you were wanting to somehow capture them in the Katalon scripts.

That was my thinking, too.

@Brandon_Hein @Russ_Thomas
No. I need the body of the different requests to appear on the Katalon Studio console.

The only way to do that is to take control of the XHR request/response from JavaScript and hand it back to your Test Case Groovy where you can publish it to the console.

No, it’s not exactly “trivial” but it could be done.

If you know of a public/exposed endpoint, I could knock up a proof-of-concept (POC) but even that would need some work.

@ThanhTo is there anything you devs have that could be packaged up as a Custom Keyword?


Doesn’t seem so at the moment. I will delegate to the team for discussions.

I found a technical article which shows how to write a Java code which

  1. start BrowserMob proxy to capture all requests and responses, both of header and content.
  2. gets a HAR (HTTP Archive) file from BrowserMob proxy
  3. stop proxy once HAR has been obtained
  4. gets information out of the HAR to process further; filter portions; make assertions; save it into local files; print the headers and the content in the console, etc.

If someone can implement it as a set of Keywords as a Plugin, it may be welcomed. Can it be a new KSE feature?

Sorry, this article is in Japanese, and the sample codes in the article are not runnable, are just psuedo code fragments.

While we are on the subject of potential build-in keywords, here’s my topic on how I was able to use BrowserMob to add header data to each request:

@ThanhTo if you are going to investigate how to capture response data with BrowserMob, you may as well include how to include custom request data. This type of thing has been asked for by a few users in the past as well (specifically ModHeader functionality).