Hi community , i am not able to print the payload and response from network tab in katalon console. can anyone respond me regards this

i’m facing some issue, while trying to catch payload

2 Likes

Please explain what you have done.

1 Like

what issue you are facing? what is the error ? share the error logs,

from network tab in katalon console

What is the “network tab in katalon console”? I have never seen such thing.

Could you provide a screenshot of the “network tab in katalon console”?

1 Like
import com.kms.katalon.core.webservice.keyword.WS
import com.kms.katalon.core.webservice.objects.RequestObject
import com.kms.katalon.core.webservice.objects.ResponseObject

// 1. Define your Request Object (assuming you have one in Object Repository)
// Or create one dynamically like this:
RequestObject request = new RequestObject()

// 2. Define the request details
request.setRestRequestMethod('POST')
request.setRestUrl('https://jsonplaceholder.typicode.com/posts')
request.setHttpHeaderProperties([new com.kms.katalon.core.webservice.common.HttpHeader('Content-Type', 'application/json')])

// 3. Set the payload (request body)
String payload = '{"title": "foo", "body": "bar", "userId": 1}'
request.setHttpBody(payload)

// 4. Print the Request Payload BEFORE sending
println "--- Request Payload ---"
println request.getHttpBody()
println "-----------------------"

// 5. Send the request and get the response
ResponseObject response = WS.sendRequest(request)

// 6. Print the Response Body AFTER receiving
println "--- Response Body ---"
println response.getResponseBodyContent()
println "---------------------"

// Optional: Print the status code as well
println "Response Status Code: " + response.getStatusCode()

were you able to catch the payload with the above example @chetan.chavan

2 Likes

let me check i was looking for same idea

@chetan.chavan

This usually happens because Katalon does not automatically capture Network tab traffic (payload/response) like a browser’s DevTools does. You need to explicitly enable or handle it depending on your approach.

Here are a few ways to fix it:

1. Enable DevTools / HAR capture (Recommended)

Katalon doesn’t log API payloads from UI execution by default. You can enable network capturing using DevTools:

  • Use Chrome DevTools Protocol (CDP) in Katalon

  • Enable Network tracking before your action:

import com.kms.katalon.core.webui.driver.DriverFactory
import org.openqa.selenium.devtools.DevTools
import org.openqa.selenium.devtools.v109.network.Network

def driver = DriverFactory.getWebDriver()
DevTools devTools = driver.getDevTools()
devTools.createSession()
devTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()))

devTools.addListener(Network.requestWillBeSent(), { request ->
    println("Request Payload: " + request.getRequest().getPostData())
})

devTools.addListener(Network.responseReceived(), { response ->
    println("Response: " + response.getResponse().getUrl())
})

2. If you’re testing APIs (Web Service Requests)

If this is for API testing:

  • Use WS.sendRequest()

  • Then print response like:

def response = WS.sendRequest(findTestObject('YourRequest'))

println("Response Body: " + response.getResponseBodyContent())
println("Status Code: " + response.getStatusCode())

3. Common issues to check

  • Payload is null → request might be GET (no body)

  • Console not printing → check Log Viewer settings

  • Using Web Recorder → it does NOT capture network payloads

  • Running in headless mode → sometimes CDP logs are limited



Bottom line

Katalon by default doesn’t expose Network tab payloads, so you must use DevTools (CDP) or API request methods to capture and print them.

Another possible approach: BrowserMob Proxy in Katalon Studio, a sample project