WebUI - wait for API call


I have following situation to solve. I want to wait until some API action is done, which does not have any visible output in UI. For example - I have a user, I click delete, but server is slow and it may take few seconds. The only way how to be sure that user is really deleted is to check API call, if it is done and returned 204.

Of course this may be changed in application, but unfortunately it is not possible now. So I’d really appreciate to have few keywords also for network traffic such as getAllApiCalls(), getApiCall(String endpoint), waitForApiCall(String endpoint) and similar. It’d be really helpful!



I too am searching for a solution related to waiting on a response from an API call. My use case is a bit different though in that I want Katalon to mash a button responsible for making a post request that generates dummy data in my database for future testing and deletes stale data from previous testing. Proceeding as a result of the http response is important to me so that I can be confident that I can anticipate the correct page elements as my test script proceeds

I have this same scenario! Sometimes the platform call completes quickly but most of the time it’s rather slow. I’m curious how you handled this…


Is there any solution ? I have the same problem … Need to wait for an API call answer

This can be achieved by hijacking the return (promise completion?) of the XHR/fetch call. To do that, you must use JavaScript and (obviously) know the details of the call site in the browser page.

Your hijack must post a unique result (possibly a global object hanging off the window object) which your Groovy code will poll for until a specified timeout occurs.

Easy enough if you know what you’re doing and understand the page code. Otherwise, not exactly trivial.

If the page uses jQuery, it’s possible to attach another handler to the promise/XHR. Once again, not exactly trivial, but is likely to be a little “cleaner” to implement. The Groovy poll routine would be identical, though.

The best solution is to have the developers publish the result to the window object for you. Then you only need to write the second part, the Groovy poll routine.