When we load any URL the dynamic browser loads many other requests along with original URL request. For example when we load the web page
several other web requests are sent by the browser to the server
In the above example, I want to send the below request to the server and want to get return data in json format
Now Captures Request (Regex) comes into the picture. In the Navigate URL command of this request, I will set the Capture Request (Regex) property to capture all request similar to the pattern I provide in the Regex box
I will set the following string in the Regex Box to get all the similar request during the load of this above URL
Now dynamic browser loads the above URL, the requests similar to above pattern get captured.
Using the Captured
You can use the captured request anywhere in your agent, in the scripting by using the following code
There could be more than one request captured during the load. "1" represents the item number in the list of captured requests.
In the above example when I use the above code in my Calculated Value command to get the captured request, I get the following result
https://api.oneroof.co.nz/v1.8/house/1337378/trading-records/nearby?limit=7??headers=Accept: application/json, text/plain, */* Accept-Language: en-US,en;q=0.9 Authorization: Public QjQxbjczaXZiay13MFc4T3lFa20xLXdobW5FOXc2NmU6cHM0ejFhNGM1Si1OcERjNnVqWDY3LVlOeUJnWDhEN28= Client: web Origin: https://www.oneroof.co.nz Sign: 6deddb3a500f969a6a82cd5ac9c08c36 Timestamp: 1571832909384 User-uuid: D5B8ED0A08A41C87A5B10E45844BD24339E3 Referer: https://www.oneroof.co.nz/
Here you can see that I captured the request but don't need to calculate the Authorization, Sign, Timestamp or User-uuid which are required to send along with the request.
Further I can use the above captured request in my Navigate URL command and can get the expected data from the web server.
A sample agent demonstrating the above feature is attached herewith.