Skip to main content

Using Capture Request (Regex) property in Agent Commands

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 


Now it may be the case that a particular request has some data in return that you want in your agent, but that request has some input query strings or payload data, that is to be sent along with the request but you don't know those parameters as they are calculated by some javascript internally.

In the above example, I want to send the below request to the server and want to get return data in json format


In this request you can see that some headers like Authorization, Sign, Timestamp, User-uuid are being sent along with the request and these parameters are calculated internally by some javascript and I cannot calculate them at all.

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*/trading-records/nearby\?limit=7

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

CODE application/json, text/plain, */*
Accept-Language: en-US,en;q=0.9
Authorization: Public QjQxbjczaXZiay13MFc4T3lFa20xLXdobW5FOXc2NmU6cHM0ejFhNGM1Si1OcERjNnVqWDY3LVlOeUJnWDhEN28=
Client: web
Sign: 6deddb3a500f969a6a82cd5ac9c08c36
Timestamp: 1571832909384
User-uuid: D5B8ED0A08A41C87A5B10E45844BD24339E3


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.


  • oneroof.scgx(6 KB)

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.