LoadRunner Correlation

From PeformIQ Upgrade
Jump to navigation Jump to search

Scraping Binary Data within LoadRunner Scripts

Using Winsocket...

The left boundary is composed of 3F and DD. The right boundary is composed of CC and b.

So:

web_reg_save_param("ParamName",
                   "LB/BIN=\\x3F\\xDD",
                   "RB/BIN=\\xCCb",
                   LAST);

For whichever boundary, use BIN with LB and RB, then web_reg_save_param() can be used with binary data.

Capture the Entire Page Body in HTML

To capture the whole data from a body of server's response use the web_reg_save_param()function as follows:


web_reg_save_param("body",
                   "LB=\r\n\r\n",
                   "RB=",
                   LAST);

This function should be placed before the web_url() function which will return the data. After execution, the parameter, 'Body', will contain the body data.

I will clarify briefly the meaning of boundaries - "LB=\r\n\r\n" and "RB=". Please, read the basic concepts of HTTP protocol, read Request message section:

A requirement of the HTTP protocol is that the header and body of a HTTP return be separated by an empty line (i.e. two (2) CRLF pairs)

The first CRLF ends the last line of the header. Note, The C notation for a carriage return (CR) is "\n" and line feed (LF) is "\n". The second CRLF ("\r\n") creates the blank line.

All data following the second CRLF will be the message body.

So to summarize, the specification ("LB=\r\n\r\n") means "start capturing from the beginning of message body". The empty right boundary ("RB=") will be interpreted as "capture data up to the end of the message".

Note that server returns the length of file to be downloaded in the header and this can be used when using this mechanism to download files.

See File Download for an example.

Catpuring Data from HTML Page Headers