API Testing - Chrome dev tool

Hi Team , I wanted to know how we can validate the api response in real time. so the scenario is we have one chatbot on our UI platform , User will enter some keywords and chatbot will reply to the user. In the same process there will be multiple API which would get triggered and we need to validate their response. manually we open chrome dev tool and see the response . is there any way to automate this ? @Katalon_team @kazurayam @Russ_Thomas @bionel @grylion54

It seems that you can automate it using Katalon’s built-in WebService testing feature. You wouldn’t need your test script to interact with Chrome DevTools through Chrome Devtools Protocol.

For example, the page includes the following test code example:

import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.util.KeywordUtil
import mypackage.SampleRequestObject
import mypackage.SampleResponseObject as SampleResponseObject
SampleRequestObject req = new SampleRequestObject()
ResponseObject resp = req.buildApiRequest1()
if(SampleResponseObject.getStatusCode(resp) != 200) {
KeywordUtil.markFailed("Status code is not 200 as expected. It is "
+ SampleResponseObject.getStatusCode(resp))
if(SampleResponseObject.getWaitingTime(resp) > 5000) {
KeywordUtil.markFailed("Your request takes more than 5000ms. Actual time is "
+ SampleResponseObject.getWaitingTime(resp))

This checks the status code of an HTTP Response. It checks how long milli-seconds it took before receiving a HTTP response. If you want to, you can write code that look into the data in the reponse in detail.

Isn’t it enough? If not enough, please describe what more you want.

Thanks for quick response. Do you mean that we should create a custom request body ( similar to request body that will get generated by performing same UI operations ) and fetch the response and validate that ? Not sure what is the difference between observing the API response in real time using the dev tool and creating API request manually . i am very confused if both the things are same ? I had a call with my lead yesterday and he was asking if we can get response in HAR files.

Me too. I am confused as well.

I do not see what you mean “observing the API response in real time using the dev tools”.

Yes. See the following doc:

Thanks. I will try to post some screenshots tomorrow. Hope it gets cleared with that

I made a quick search with key “test chatbot” and found the following article:

Is this article helpful for you?

Katalon Studio has no interactive UI that enables you to exchange messages with chatbots real-time. So possibly you had better to use other test runners like Cypress.

so this is our chatbot Interface. so manual testing team provides inputs/query to chatbot , and gets the reply in return . simultaneously one API gets triggered and manual tester validate the response of that . for eg When User provided “My leave balance” as his input , Mydemo API got triggered and in response, type should be articles. so basically User input ( in this case “My leave balance” ) gets added into request body and accordingly API gives the response . so my question is -

  1. what is difference between observing that API response in dev tool VS hitting that same API as a standalone API test ( obviously with same user input)

I suggested that both test cases can be independent whereas my manager is suggesting to record the realtime traffic and saving it in HAR and then validating the response of that particular API. Plz provide ur valuable suggestions. Thanks

How do you “validate” it? Are you going to prepare a JSON Schema instance and apply it to the reponse documents? If not, how?

can u check my updated post. I have edited it. hope it is more clear now

It’s too difficult for me to understand.
Anyone else?

@kazurayam This is inline with what i discussed in my previous post. The bottom-line was to grab network tab response . I am using browsermob proxy to generate my HAR file. below is my code. it does generate har file but i dont see any content on it. can someone plz help-


BrowserMobProxy myProxy=new BrowserMobProxyServer();

Proxy seleniumProxy=new Proxy();

DesiredCapabilities capability=new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, seleniumProxy);
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability (CapabilityType.ACCEPT_INSECURE_CERTS, true);

EnumSet <CaptureType> captureTypes=CaptureType.getAllContentCaptureTypes();



ChromeOptions options=new ChromeOptions();

WebDriver driver=new ChromeDriver(options);
System.out.println("Driver Capabilities===> \n" +((RemoteWebDriver)driver).getCapabilities().asMap().toString());

WebElement username=driver.findElement(By.id("username"));
WebElement password=driver.findElement(By.id("password"));
WebElement login=driver.findElement(By.id("login"));


Har har = myProxy.getHar();
File myHARFile=new File("C:/HARFolder/googleHAR1.har");

System.out.println("==> HAR details has been successfully written in the file.....");

Sorry, I can’t help. You’re doing something very different to “normal” here.

I’d like to make a request though. When you’ve managed to automate this entire workflow, please write a HowTo (Tips & Tricks) article and post it on the forum. The integrations alone are worth documenting.


1 Like

No, I can’t, sorry.

1 Like