# How to capture network traffic and retrieve http requests info in Katalon Studio Projects.?

**URL:** <https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687>\
**Category:** Miscellaneous\
**Tags:** start-page\
**Created:** [November 17, 2022, 6:17am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687 "2022-11-17T06:17:07Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakesh.m](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/rakesh.m/32/20464_2.png) [@rakesh.m](https://forum.katalon.com/u/rakesh.m)\
**Post date:** [November 17, 2022, 6:17am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/1 "2022-11-17T06:17:07Z")

</div>

Hi All,

i’m trying to capture http requests in runtime and use the specific data from api response in katalon studio projects.

I tried to implement mobproxy in the test suite but thats wasn’t helpful.  
is there a way we can achieve this.?

Thanks  
Rakesh

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 17, 2022, 1:50pm UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/2 "2022-11-17T13:50:16Z")

</div>

@anon46315158 is your man here methinks.

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [November 17, 2022, 7:56pm UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/3 "2022-11-17T19:56:49Z")

</div>

@Russ_Thomas  
not yet.  
i don’t understand the question.  
it is about sending a certain http request (api call) and parse the response, or it is about loading a webpage and capture all api calls under the hood of the webbrowser?  
but let’s wait for @rakesh.m input

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 18, 2022, 12:27am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/4 "2022-11-18T00:27:28Z")

</div>

> [@anon46315158](#):
>
> … or it is about loading a webpage and capture all api calls under the hood of the webbrowser?

This looks something similar to

 ![sequence](https://europe1.discourse-cdn.com/katalon/original/3X/c/5/c56f0336e2774affdeabb9f25e97e3d295b45eaa.png)  
in

[http://forum.katalon.com/t/visual-inspection-of-css-and-javascript/61979](http://forum.katalon.com/t/visual-inspection-of-css-and-javascript/61979)

which used [Chrome DevTools Protocol, Network Domain](https://rahulshettyacademy.com/blog/index.php/2021/11/04/selenium-4-feature-chrome-dev-tools-protocol/#t-1636049095554)

---

<div class="post-metadata">

**Author:** ![rakesh.m](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/rakesh.m/32/20464_2.png) [@rakesh.m](https://forum.katalon.com/u/rakesh.m)\
**Post date:** [November 18, 2022, 1:07am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/5 "2022-11-18T01:07:35Z")

</div>

Usecase : in testscript execution at some point there is a save operation where an api is triggered to save the details. We need to capture that api response and use its parameters in next steps for data validation.

---

<div class="post-metadata">

**Author:** ![rakesh.m](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/rakesh.m/32/20464_2.png) [@rakesh.m](https://forum.katalon.com/u/rakesh.m)\
**Post date:** [November 18, 2022, 1:10am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/6 "2022-11-18T01:10:10Z")

</div>

Also we are not supposed to use the alpha versions of katalon studio as the tests need to be executed in testcloud. Only official release versions.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 18, 2022, 1:25am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/7 "2022-11-18T01:25:28Z")

</div>

> [@rakesh.m](#):
>
> Usecase : in testscript execution at some point there is a save operation where an api is triggered to save the details. We need to capture that api response and use its parameters in next steps for data validation.

Are you going to involve a web browser (Chrome, FireFox, …) during your test?

Or are you goint to make HTTP GET/POST request to a URL using RESTFull/SOAP API?

(you put this post with “web-testing” category, but your description seems suggesting it is not “web-testing”)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 18, 2022, 1:35am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/8 "2022-11-18T01:35:32Z")

</div>

> [@rakesh.m](#):
>
> We need to capture that api response …

Are you asking us how to get a JSON/XML text out of the Request object?

The following post may interest you:

> [@How to extract response body parameters](http://forum.katalon.com/t/how-to-extract-response-body-parameters/8972):
>
> Hey Guys, I was wondering if anyone could help me with this. Katalon script file Object response = WS.sendRequest(findTestObject('PublicApi/PublicApiEndPoint')) System.out.println(response.getResponseText()) In the above script file, getResponseText() method spits out below reponse, how do I extract the value for parameter, lets say “authenticationToken”, “displayName” etc… {"authenticationToken":"tokenValue", "displayName":"Service Desk User", "smartNumber":"+54315645646"} I don’t see a …

---

<div class="post-metadata">

**Author:** ![rakesh.m](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/rakesh.m/32/20464_2.png) [@rakesh.m](https://forum.katalon.com/u/rakesh.m)\
**Post date:** [November 18, 2022, 3:42am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/9 "2022-11-18T03:42:32Z")

</div>

Yes i do post request for getting the response.

as mainly this usecase is about intercepting the http calls and then utilizing the response. so i have put this in web category.

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [November 18, 2022, 3:58pm UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/10 "2022-11-18T15:58:00Z")

</div>

i am tired of this mess.  
trying to look into the documentation, where code snipets used to be, nothing there.  
anyway …

@rakesh.m i still don’t understand your question.  
what traffic to intercept?  
you are sending a request, therefore, from the repsonse object grab whatever you like:  
see: [ResponseObject (Katalon Studio API Specification)](https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html)

unfortunately, I am not able to give you quick examples on how to build a request quickly from a test object, how to get the data from it, how to send it and how to parse the response.

the new doc is confusing and nothing is where it used to be, therefore kindly don’t ping me anymore on this topic.

attn @Russ_Thomas

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 18, 2022, 4:13pm UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/11 "2022-11-18T16:13:22Z")

</div>

Here is my take.

As a normal part of the AUT’s execution, it submits an API call to some endpoint.

In your test you want to somehow grab a copy of the response from the API, get some of the data from it and use that data in subsequent steps in your test.

Correct?

I don’t think there is a way using Katalon’s WS API set to grab a copy of an API call to do what you want to do.

My advice:

1. Make the API call in a separate test case using Katalon’s WS API. Prove the API is working correctly independent of the AUT. If not, you have a failure.

2. Use Katalon’s WebUI APIs to test the _outcomes_ of a successful submission. That is, check the AUT behaves correctly when an API call is successful. If it doesn’t, you have a failure.

If I’ve misunderstood, then you need to state your problem/question more clearly. As you can see, you are already causing some considerable frustration among seasoned test engineers.

Thanks.

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [November 19, 2022, 10:23am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/12 "2022-11-19T10:23:54Z")

</div>

> [@rakesh.m](#):
>
> Yes i do post request for getting the response.

Provided this is true, and I am guessing right that you have a certain test object defined to send the Post request, you may have to read here:

[https://docs.katalon.com/docs/legacy/katalon-studio-enterprise/test-design/web-services-test-design/using-web-services-in-a-test-case#in-test-case-editors-script-view](https://docs.katalon.com/docs/legacy/katalon-studio-enterprise/test-design/web-services-test-design/using-web-services-in-a-test-case#in-test-case-editors-script-view)

so, everything you need is in the response object if you do it like:

```auto
def response = WS.sendRequest(findTestObject([]))

```

otherwise, you have to bring more details.  
can you show us your test-case code?

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 19, 2022, 1:36pm UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/13 "2022-11-19T13:36:58Z")

</div>

> [@Russ\_Thomas](#):
>
> As a normal part of the AUT’s execution, it submits an API call to some endpoint.
> 
> In your test you want to somehow grab a copy of the response from the API, get some of the data from it and use that data in subsequent steps in your test.

If this is the case, **the URL of the endpoint is hidden somewhere in the web user interface on browser**. The URL will not be exposed to users. @rakesh.m would never know the URL. Therefore he would not be able to make the API call using Katalon’s WS API.

This difficulty might be resolved by CDP Network feature, like this:

[![](https://kazurayam.github.io/VisualInspectionOfCssAndJs/diagrams/out/sequence/sequence.png) ](https://kazurayam.github.io/VisualInspectionOfCssAndJs/diagrams/out/sequence/sequence.png)

In this figure, the Tester knows only the URL of a HTML page. He does not know the URL of CSS and JavaScript that are linked to from the HTML page. Chrome browser can find all URLs. So, via CDP, you can ask Chrome browser to inform you of the URLs of HTML + CSS + JS and other details exchanged over network (such as HTTP Response Status code) . Possbily CDP Network feature supports the backend API endpoits as well.

Of course, CDP requires a serious custom programming efforts. You need to be highly skilled. Katalon Studio provides no support for it.

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [November 19, 2022, 2:48pm UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/14 "2022-11-19T14:48:30Z")

</div>

> [@kazurayam](#):
>
> If this is the case, **the URL of the endpoint is hidden somewhere in the web user interface on browser**

agreed we disagree.  
the user said he send the request.  
therefore, before moving forward, let us wait for a sane input on this matter, otherwise is just waste of our time.

---

<div class="post-metadata">

**Author:** ![rakesh.m](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/rakesh.m/32/20464_2.png) [@rakesh.m](https://forum.katalon.com/u/rakesh.m)\
**Post date:** [November 21, 2022, 3:57am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/15 "2022-11-21T03:57:51Z")

</div>

> [@anon46315158](#):
>
> @rakesh.m i still don’t understand your question.

The HTTP response(network XHR Calls/responses) i need to intercept.

---

<div class="post-metadata">

**Author:** ![rakesh.m](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/rakesh.m/32/20464_2.png) [@rakesh.m](https://forum.katalon.com/u/rakesh.m)\
**Post date:** [November 21, 2022, 4:00am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/16 "2022-11-21T04:00:24Z")

</div>

> [@Russ\_Thomas](#):
>
> e Katalon’s WebUI APIs to test the _outcomes_ of a successful submission. That is, check the AUT behaves correctly when an API call is succe

Perfect Understanding. but the thing while im running the tests, if i could capture those https requests/responses from network tab then it would be very useful for me to validate through api’s as we tried doing via web but its relatively slower and it takes more time for validation.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 21, 2022, 4:43am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/17 "2022-11-21T04:43:53Z")

</div>

> [@rakesh.m](#):
>
> if i could capture those https requests/responses from network tab

You can do it if you could write a script that drivers Chrome DevTools Protocol, Network domain.

A sample is here

> <https://github.com/kklisura/chrome-devtools-java-client/blob/master/cdt-examples/src/main/java/com/github/kklisura/cdt/examples/TracingExample.java>

or read an article

> **[Selenium 4 Key Feature: Network Interception - Rahul Shetty Academy Blog](https://rahulshettyacademy.com/blog/index.php/2021/11/04/selenium-4-key-feature-network-interception/#t-1636047172262)**
>
> Table of Contents Capture Network Request in Selenium 4Capturing Network Response with CDP in Selenium 4Blocking URL using Chrome DevTools Protocol in SeleniumLoading Insecure Website using CDP in Selenium 4Network Emulation and Controlling Network...

Unfortunately Katalon Studio does not provide built-in support CDP at all.

But you can develop your custom Groovy code in Katalon Studio that utilizes kklisura’s lib and use CDP features.

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [November 28, 2022, 8:58am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/18 "2022-11-28T08:58:45Z")

</div>

@rakesh.m sorry for late reply, was a bit busy those days …  
Well, now I understand what do you need.  
You can follow the path proposed by @kazurayam … or show us what you tried with mobproxy and where did you failed.

Mobroxy it is used under the hood by Katalon to intercept API responses as .har files when doing Webservice tests, as far as I know.  
So, most of the needed libraries should be already present.

E.g something like this should work: [BrowserMob Proxy Selenium Java Tutorial with an Example!](https://www.swtestacademy.com/browsermob-proxy-selenium-java/)

Of-course, the code sample there have to be adapted to Katalon …  
Unfortunately, I am very rusty with WebUI testing (and with testing in general, at my current work I am doing different stuff now) …  
But, if you show us your code, and what failures you have, perhaps somebody more ‘up-to-date’ and more patient from the community can help you, e.g Kazu or @Russ_Thomas

For now, focus on just getting a .har file to be generated when you navigate to a certain page.  
How to parse it and extract the data needed … later. Although the har file is just a json, such tend to be very large with WebUI tests, depending on the resources loaded by your AUT, compared with .har files generated by API calls with Webservice testing.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [February 10, 2023, 9:53am UTC](https://forum.katalon.com/t/how-to-capture-network-traffic-and-retrieve-http-requests-info-in-katalon-studio-projects/80687/19 "2023-02-10T09:53:53Z")

</div>

I developed an example of using CDP in Katalon Studio. See

[http://forum.katalon.com/t/visual-inspection-of-css-and-javascript/61979](http://forum.katalon.com/t/visual-inspection-of-css-and-javascript/61979)
