Get XHR response

Hi All,

Hope all is well.

Is there other way to get xhr body without using or creating WS Request.
What we need is to get this two info (Please see screenshot) once we land on this page.
This is a new feature so we don’t have scripts yet for it, still in preparation and still collecting information how to automate it.Once we got Farecode and Description we can proceed on the next step to verify what should happen on UI

Keep safe all!, Thank you very much!

cc: @Katalon_Studio, @Marek_Melocik, @kazurayam, @Russ_Thomas, @Brandon_Hein, @ThanhTo, @devalex88

I suppose your web page has onLoad event handlers in JavaScript, which are invoked as soon as the page is loaded, and which will make XML Http Requests to get data in JSON. Am I right?

Does the OnLoad event handlers store the JSON data as XHR Responses into some JavaScript variable ?

If so, you should be able to retrieve the value of the variables by your custom JavaScript code. Your Test Case script can inject any javascript code into the web page on browser by calling WebUI.executeJavaScript(). And your injected JavaScript code should be able to retrieve values (Farecode and Description) from the stored data and return them to the caller test case script.

Yes.

Broadly speaking, you have two choices.

  1. Implement the xhr call yourself in Groovy-JS and collect/inspect the result yourself. (I do this in my tests.)

  2. Implement the call via the AUT as normal and inspect the effective state of the AUT “proving” the xhr call must have worked. (I do this too.)