Open topic with navigation
Performs an "unconditional" or "contextless" form submission.
int spdy_submit_data( const char *StepName, const char *Action, <List of Attributes>, ITEMDATA, <List of data>, [ EXTRARES, <List of Resource Attributes>,] LAST );
The HTTP address of the action to perform when submitting the data. The syntax is "Action=<urlAddress>"
The following attributes are supported:
EncodeAtSign: Encode the
EncType: The encoding method used.
Method: The form submission method: POST or GET (default: POST)
Mode: The Recording Level: HTML or HTTP. Click Mode (Recording Level) for more information.
RecContentType: The format of the data to be returned. For example, text/html.
Referer: The URL of the referring Web page. The page that referred to the current page. If the location was explicitly expressed, this attribute is omitted.
Snapshot: The returned data.
SpdyPushCount: The number of files returned.
SpdyStreamID: The communications channel ID.
TargetFrame: The name of the frame containing the current link or resource. Click TargetFrame for more information.
UserAgent: Identifies a component other than the browser that will execute the step, for example, an ActiveX component running under the browser. This user agent header is sent for the requests made by the step. No check is made to confirm that the user agent argument matches the browser's User-Agent Run-Time Setting. Non-browser steps do not affect the emulated browser context, nor do they build a new context from the result.
The list of data fields used to define the form submission. Because the request is contextless, the list of data fields includes all hidden fields. The rules of data encoding for submission of forms apply. For a list of the possible entries in the list, see web_submit_data.
This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.
The following argument(s) can be parameterized using standard parameterization: Action, Method, List of Data Fields
The spdy_submit_data function is an Action Functions that performs an "unconditional" or "context-less" form submission. (Each action function in a script causes the browser to display a new Web page or frame. All action functions can be recorded by VuGen.) This function allows you to generate GET and POST requests as made by the HTML forms. You do not need to have a form context to execute this request.
spdy_submit_data is recorded only when VuGen is in either the URL–based recording mode, or in the HTML–based recording mode with the A script containing explicit URLs only option checked (see VuGen's Recording Options).
The method indicates how the data of the form is sent to the server, whether as a query within the URL (GET), or as a request body (POST).
This function is generated when VuGen is set to record a session in HTTP (all requests from the server) recording mode. VuGen also records a spdy_submit_data statement whenever a form is submitted.
Examples of non–HTML–generated resources are .gif and .jpg images. The List of Resource Attributes is only inserted when the recording option for these resources is set at Record within the current script step. This is the default setting. See the Virtual User Generator User Guide.
The HTTP header can be modified to pass additional information about the request to the server. Using HTTP headers you can, for example, allow other content types in the response such as compressed files, or you can request a Web page only on certain conditions. To modify the HTTP header in the request, use web_add_header. To modify all subsequent requests, use web_add_auto_header.
The EncType attribute specifies a Content Type to be specified as the value of the "Content–Type" request header. It indicates the encoding type (either URL–encoding or multi–part) to be used for generating an HTTP request from other arguments. The allowed specifications are:
"EncType=multipart/form–data" (any "; boundary=" is silently ignored)
"EncType=" (an empty string, indicating that no "Content–Type" request header is to be generated).
If EncType is omitted and "Method=POST", "application/x–www–form–urlencoded" is used. If Method is not POST, no "Content–Type" request header is generated.
The possible entries in the ItemData section are:
Name - The form field name. For example:
Value - The value in the Content-Disposition parameter of the multipart message. For example: "
File - Whether the message content is a file. For example:
Content-Type - The value in the Content-Type parameter of the multipart message (for example:
"ContentType=text/special"). Content-Type, a file type specifier, is needed in the ItemData section in cases where the EncType is a multipart/form–data file upload. Content–Type is passed as one value of a data clause in the ITEMDATA section where "File=Yes" is specified, and applies only to the file in the same clause.
FilePath- The path to the uploaded file, for example,
"FilePath=stub.txt". The path can be relative (recommended) or absolute. If relative, the path is based on the path specified in the Value entry. Backslashes must be escaped. FilePath is passed as one value of a data clause in the ITEMDATA section where "File=Yes" is specified.
ContentTransferEncoding - The value in the Content-Transfer-Encoding parameter of the multipart message (for example,
"ContentTransferEncoding=html/text"). ContentTransferEncoding is passed as one value of a data clause in the ITEMDATA section where "File=Yes" is specified.
Normally, a "Content–Type" entity header is generated in the request body according to the extension of the uploaded file. For example:
–––––––––––––––––––––––––––––7d025e2b16b064e\r\n Content–Disposition: form–data; name="uploaded_file"; filename="D:\\temp\\a.txt"\r\n Content–Type: text/plain\r\n \r\n
However, especially for non–browser applications, content type based on the file type may not be correct. To override it, ContentType can be specified. Specifying an empty value will cause the Content–Type header not to be included for this file.
When the uploaded file is empty, "application/x–unknown–content–type" is used regardless of the file extension. Explicitly specifying ContentType, empty or not, overrides this mechanism.
No attempt is made to check whether the specified ContentType is recognized or valid.
When spdy_submit_data is recorded, "name" and "value" are generally recorded for items in the ITEMDATA section. If you do not wish the recorded value to appear in the script, you can encode it. Change the word "Value" to "EncryptedValue", and substitute the encoded value for the recorded value.
"Name=grpType", "Value=radRoundtrip", ENDITEM,
"Name=grpType", "EncryptedValue=409e41ebf102f3036b0549c799be3609", ENDITEM,
To get an encoded value for later use, copy the value. Then run Start > All Programs > HPE Software > HPE LoadRunner > Tools > Password Encoder. Paste the value into the Password field, and click Generate. The masked string appears in the Encoded String box. Click Copy and paste the masked string into a parameter for later use, or assign the value to a string variable.
Another option for encoding the value is to convert the entire value string to an lr.unmask call. Select an entire string between quote marks, not including the quote marks. Right-click in the string and select Mask String. The output looks like:
"Name=grpType", lr_unmask("40d176c46f3cf2f5fbfaa806bd1bcee65f0371858163"), ENDITEM,
This function is supported for all Web scripts.