web_submit_form

Submits a form.

C Language

int web_submit_form( const char *StepName, <List of Attributes>, <List of Hidden Fields>, ITEMDATA, <List of Data Fields>, [ EXTRARES, <List of Resource Attributes>,] LAST );
Example: web_submit_formAction Functions

Java Language

int object.submit_form( String stepName, String[] options, String[] data ); 
Example: web.submit_form Action FunctionsJava Syntax
ArgumentDescription
objectAn expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
StepNameThe name of the form, as it appears in the graphical script. Also used as the transaction name for automatic transactions.
List of AttributesSee below in this section: List of Attributes.
List of Hidden FieldsSee below in this section: List of Hidden Fields.
ITEMDATAA marker that separates between the attributes and the data of the form. This marker is not used in Java Language calls.
List of Data FieldsSee below in this section: List of Data Fields.
EXTRARESA demarcation parameter indicating that the next parameter will be a list of resource attributes.
List of Resource Attributes

See List of Resource Attributes

In Java language calls to lrapi.web.submit_form the list of extra resources is part of the data[] array.

LASTA marker that indicates the end of the field list.

Return Values

This function returns a 0 for success and a number greater than zero for failure.

Parameterization

The following argument(s) can be parameterized using standard parameterization: List of Attributes, List of Hidden Fields, List of Data Fields

General Information

The web_submit_form function is an action function that submits a form. (Each Web Action Function in a script causes the browser to display a new web page or frame. All Web Action functions can be recorded by VuGen.) The web_submit_form function may be executed only in the context of a previous operation.

web_submit_form is recorded only when VuGen is in HTML–based recording mode (see VuGen's Recording Options).

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 Help Center (select the relevant version).

When web_submit_form 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. For example:

Change:

"Name=grpType", "Value=radRoundtrip", ENDITEM,

to:

"Name=grpType", "EncryptedValue=409e41ebf102f3036b0549c799be3609", ENDITEM,

To get an encoded value for later use, copy the value. Then go to Windows Start menu > 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.

List of Attributes

The following attributes are supported:

Action: The ACTION attribute of the FORM element. The ACTION attribute specifies the address (URL) to be used to carry out the action of the form. You can also specify Action/sfx, which indicates to search the form using the suffix of the action.

Frame: The name of the frame in which you recorded the operation. The name of the frame is the value of the name attribute of the FRAME element.

TargetFrame

ResourceByteLimit

UserAgent, and

Ordinal.

Recorded attributes: VuGen always tries to uniquely identify each form by recording only the data fields. If this is insufficient for unique identification, VuGen records the Action attribute. (This is the Action attribute of the Form element. The Action attribute specifies the address (URL) to be used to carry out the action of the form. You can also specify Action/sfx, which indicates to search the form using the suffix of the action.) If this is still insufficient for unique identification, VuGen records the Ordinal attribute, and not the Action attribute.

In Java Language calls to lrapi.web.submit_form the attribute list is part of the options[] array.

List of Hidden Fields

Serves as an attribute. You can identify a form by using the list of the hidden fields.

The list of hidden fields has the following format:

STARTHIDDENS,
    "name=n1", "value=v1", ENDITEM,
    "name=n2", "value=v2", ENDITEM,
    "NAMEPFX=pre1_", "NAMESFX=_sfx1", "value=v3", ENDITEM,
    "NAMEPFX=pre2_", "NAMESFX=_sfx2", "value=v4", ENDITEM,
ENDHIDDENS,

The hidden fields list is optional.

name: The name attribute within an INPUT element of the field. It is the name of the field as it appears on the web page.

NAMEPFX and NAMESFX are the prefix and suffix of the name attribute within an INPUT element of a field. They identify an INPUT element when the name is dynamic but has a fixed prefix and suffix. The name attribute is the name of the field as it appears on the web page.

In Java Language calls to lrapi.web.submit_form the list of hidden fields is part of the options[] array.

List of Data Fields

Data items identify a form. A form is identified by both data items and attributes.

The list of data fields has the following format:

"name=n1", "value=v1", ENDITEM,

"name=n2", "value=v2", ENDITEM,

name: The name attribute within an INPUT element of the field. It is the name of the field as it appears on the Wweb page.

In Java language calls to lrapi.web.submit_form the list of data fields is part of the data[] array.

Changing the Header

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 see web_add_header. To modify all subsequent requests, see web_add_auto_header.