Introduction to common web functions (related to LoadRunner)

Source: Internet
Author: User

Outline:
1. web_url
2. web_image
3. web_link
4. web_submmit_form

Details:

1. web_url

Syntax:
Int web_url (const char * Name, const char * URL, [extrares, last)

Return Value
If the call succeeds, lr_pass (0) is returned. If the call fails, lr_fail (1) is returned ).

Parameters:
Name: name displayed in the Tree View of vugen. It can also be used as the name of the transaction during automatic transaction processing.

URL: the URL of the page.

List of attributes

Extrares: delimiter, marking the list of resource attributes for the next parameter.

List of resource attributes

Last: The identifier of the end of the attribute list.

Description

Web_url loads the corresponding URL Based on the URL attribute in the function, without context.

Web_url is recorded only when vugen is in the URL-based or HTML-based recording mode (when the SCR ready PT containing explicit URLs only option is selected.

You can use web_url to simulate downloading files from the FTP server. The web_url function allows the FTP server to perform operations when the file is actually downloaded. Unless "ftpascii = 1" is specified manually, the download is completed in binary mode.

In the recording option, under toos-recording option, there is an advanced
HTML option, you can set whether to record non-HTML resources, only when "record within the current SCR limit PT" is selected
"Step", the list of resource attributes will be recorded. Examples of non-HTML resources are GIF and jpg image files.

You can modify the HTTP header to send additional request information to the server. The HTTP header allows the request to contain other content types (content_type), like compressed files. You can also request only web pages in a specific status.

All Web vusers, WAP vusers in http mode, or Wireless Session Protocol (WSP) in playback mode support the web_url function.

Ii. web_image

Syntax:
Int web_image (const char * stepname, [extrares,] Last );

Return Value
If the call succeeds, lr_pass (0) is returned. If the call fails, lr_fail (1) is returned ).

Parameters:
Stepname: name displayed in the Tree View in vugen. It can also be used as the transaction name in automatic transaction processing.

List of attributes (server-side and client-side ing images): the src attribute will be recorded, if other types of ALT, frame, targetframe, and ordinal exist, they will be recorded.

1. alt: the element that describes the image. The text prompt that appears when you point to the image with the mouse.

2. SRC: Specifies the image element. It can be the image file name, for example, button.gif. You can also use src/SFX to specify the suffix of the image path. All strings with the same suffix will be matched.

3. frame: the name of the frame in which the recording operation is performed.

4. targetframe: see parameters with the same name as list of attributes.

5. ordinal: see web_link parameters with the same name.

List of attributes (client-mapped image ):

1. areaalt: Click the alt attribute of the area.

2. areaordinal: Click the sequence number of the area.

3. mapname: The ing name of the image.

List of attributes (server-side ing image): Although clicking the coordinate does not belong to the attribute, it is still used in the attribute format.

1. xcoord: X coordinate of the image.

2. ycoord: Click the Y coordinate of the image.

Extrares: delimiter, marking the list of resource attributes for the next parameter.

List of resource attributes: see the list of resource attributes section.

Last: The identifier of the end of the attribute list.

Description

Web_image simulates the mouse clicking action on the specified image. This function must be used in the context of a pre-operation.

In toos-recording option, if the recording level is set to hmtl-based, web_image will be recorded.

Web_image supports image ing between client-side and server-side.

In the recording option, under toos-recording option, there is an advanced
HTML option, you can set whether to record non-HTML resources, only when "record within the current SCR limit PT" is selected
"Step", the list of resource attributes will be recorded. Examples of non-HTML resources are GIF and jpg image files.

You can modify the HTTP header to send additional request information to the server. The HTTP header allows the request to contain content, just like a compressed file. You can also request only web pages in a specific status.

Web_image supports Web virtual users and does not support WAP virtual users.

Example

The following example simulates a user clicking the home icon to return to the home page (in the black box ):

Web_url ("my_home", "url = http: // my_home/", last );

Web_link ("employees", "text = employees", last );

Web_image(“home.gif "," src = ../GIFs/buttons/home.gif ", last );

Web_link ("library", "text = library", last );

Web_image(“home.gif "," src = http://www.cnblogs.com/gifs/buttons/home.gif”, last );

In the following example, you can click:

Web_image(registrdpt_house.gif ",

"Src = ../GIFs/dpt_house.gif ",

"Mapname = dpt_house ",

"Areaordinal = 4 ″,

Last );

In the following example, the user clicks on the server-side ing image:

Web_image ("the Web Developer's Virtual Library ",

"ALT = the Web Developer's Virtual Library ",

"Ordinal = 1 ″,

"Xcoord = 91 ″,

"Ycoord = 17 ″,

Last );

The following is an example of using a filename Suffix: suffix as the suffix, so such as ../GIFs/dpt_house.gif,/GIFs/dpt_house.gif, GIFs/dpt_house.gif,/dpt_house.gif, etc.

Web_image(registrdpt_house.gif ",

"Src/sfx=dpt_house.gif", last );

3. web_link

Syntax:
Int web_link (const char * stepname, [extrares,] Last );

Return Value
If the call succeeds, lr_pass (0) is returned. If the call fails, lr_fail (1) is returned ).

Parameters:
Stepname: name displayed in the Tree View in vugen. It is also used as the transaction name in the automatic transaction settings.

List of attributes: the following attributes are supported:

1. Text: the text in the hyperlink, which must be exactly matched.

2. frame: the name of the frame in which the recording operation is performed.

3. targetframe and resourcebytelimit: see the list of attributes section.

4. ordinal: If the elements filtered by using the given attribute (attributes) are not unique, vugen uses this attribute to specify one of them. For example, when src?abc.gif=, ordinal=3}the value of srcis 3rd images in "abc.gif.

Extrares: indicates that the following parameter will be list of resource attributes.

Last: End identifier.

Description

The simulated mouse clicks on the Link described by several property sets. This function can be executed only in the context of the preaction.

Web_link is captured by vugen only in HTML-based recording mode.

Examples of non-HTML resources include .gif and .jpg images. For list of resources
For the attributes parameter, only when the recording options-recording-HTML-based SCR limit Pt-record
When the within the current SCR limit PT step option is selected, they will be insertedCode.

You can change the HTTP header to send additional information to the server. You can use HTTP header information to allow the response body to contain other content types (Content-Type), such as compressed files, or request a Web page only when a specific status is satisfied.

This function supports Web virtual users and does not support WAP virtual users.

4. web_submmit_form

Syntax:
Int web_submit_form (const char * stepname, itemdata, [extrares,] Last );

Return Value
If the call succeeds, lr_pass (0) is returned. If the call fails, lr_fail (1) is returned ).

Parameters:
Stepname: form name. Name displayed in the Tree View in vugen. The name can also be used for automatic transaction processing.
List of attributes: the following attributes are supported:

1. Action: The action attribute in form, specifying the URL used to complete the operation in form. You can also use "Action/SFX" to indicate all actions with this suffix.

2. frame: the name of the frame in which the recording operation is performed.

3. targetframe and resourcebytelimit: see parameters of the same name in list of attributes.

4. ordinal: see web_link parameters with the same name.

Vugen uniquely identifies each form in the data field. If this is not enough to identify the form, vugen records the action attribute. If not, the ordinal attribute is recorded. In this case, the action attribute is not recorded.

List of hidden fields: Complementary attribute (serves ). Using this attribute, you can use a string of hidden fields to identify the form. Use the following format:

Starthiddens,

"Name = N1", "value = V1", Enditem,

"Name = n2", "value = V2", Enditem,

Endhiddens,

List of data fields

The data item is used to identify the form. Form is recognized by attributes and data.

The following format is used to represent the data domain list.

"Name = N1", "value = V1", Enditem,

"Name = n2", "value = V2", Enditem,

Itemdata: the delimiter between data and attributes in form.

Extrares: a delimiter that indicates the list of resource attributes for the next parameter.

List of resource attributes: see the list of resource attributes section.

Last: The identifier of the end of the attribute list.

Description

The web_submit_form function is used to submit a form. This function may have to be executed in the context of the previous operation. In toos-recording option, web_image is recorded only when the recording level is set to hmtl-based.

In the recording option, under toos-recording option, there is an advanced
HTML option, you can set whether to record non-HTML resources, only when "record within the current SCR limit PT" is selected
"Step", the list of resource attributes will be recorded. Examples of non-HTML resources are GIF and jpg image files.

Normally, if web_submit_form is recorded
Function. vugen records "name" and "value" together to the itemdata attribute. If you do not want to display "value" in plain text in the script, you can encrypt it. Set
Change "value" to "encryptedvalue", and change the recorded value to the encrypted value.

For example, you can set "name = grptype", "value = radroundtrip", Enditem

Change to: "name = grptype", encryptedvalue = 409e41ebf102f3036b0549c799be3609 ", Enditem

If you have installed LoadRunner, open the Start Menu-Mercury LoadRunner-tools-Password
Encoder, which is used to encrypt strings. Paste the value to be encrypted into the password column and click Generate. The encrypted string will appear in
Encoded string box. Click the copy button and paste it into the script to overwrite the previously displayed "value ".

Use the lr_decrypt function in another encryption method. Method: select the entire string, for example, "value = radroundtrip" (do not select the quotation marks), right-click the mouse, select encrypt string, and the script will change:

"Name = grptype", lr_decrypt ("40d176c46f3cf2f5fbfaa806bd1bcee65f0371858163"), Enditem,

Web_submit_form supports Web virtual users, but does not support WAP virtual users.

These are commonly used when LoadRunner is recording, reading, editing, and enhancing scripts.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.