Introduction to common web functions (LoadRunner related)

Source: Internet
Author: User
Tags list of attributes

Introduction Outline:
1. Web_url
2. Web_image
3. Web_link
4. Web_submmit_form

Detailed Description:

I. Web_url

Web_url
Grammar:
Int web_url (const char *name, const char * URL, <lists of Attributes>, [Extrares,<lists of Resource Attributes> ;, last)

return value
Returns Lr_pass (0) on success and returns Lr_fail (1) On failure.
Parameters:
The name that is displayed in the tree view in Name:vugen, which can also be used as the name of the transaction in automatic transactions.
URL: page URL address.
List of Attributes: (supports the following properties)
1 targetframe
2 TargetBrowser or Targetbrowserordinal
3 Reccontenttype-The header text type of the response during recording (text/html, application/x-JavaScript), which is to confirm that the destination URL is a recordable resource.
4 Referer-The URL of the page request to submit. (Gets the current page, if the location is explicitly indicated, then this property is invalid or ignored.) The URL is indicated, the page to get)
5 Resource-Specify a value that indicates whether the URL is a resource, 0 means not a resource, and 1 means a resource
6 Snapshot-Snapshot, Snapshot file name, used for correlation.
7 mode-the level of recording, whether it is HTML or HTTP mode.

Extrares: Delimiter, which represents the following list, is a request generated by script, active, Java applet, Flash (specifically set in, Recorded options--recording--Select HTML Base SCRITP-- -HTML reccorded can set whether these things need to be recorded. )。
List of Resource Attributes: Downloaded resource properties
Url
The URL (Uniform Resource Locator) of the web Resource to load
Web resources to download via URL address (resource uniform locator)
Referer
The URL of the referring Web page.
The page that sent the download request. such as a swf to download a picture, then SWF is Referer
Enditem
A marker that indicates the end of each resource in the list.
End marker for each resource in the list
Last: The marker at the end of the property list.
Description
Web_url loads the corresponding URL based on the URL property in the function, no context is required.
You can use Web_url emulation to download files from an FTP server. The Web_url function causes the FTP server to perform the operation when the file is actually downloaded. Unless "Ftpascii=1" is manually specified, the download is done in binary mode.

In the recording options, under Toos-recording option, the recording option has an advanced HTML option that lets you set whether to record non-HTML resources,
The List of Resource attributes is only recorded when the "record within the current script step" is selected.
Examples of non-HTML resources are GIF and JPG image files.

Some additional request information can be passed to the server by modifying the HTTP header. Using 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 state.

Web_url functions are supported for all Web Vusers, WAP vusers in HTTP mode, or wireless Session Protocol (WSP) in playback mode.

Two. Web_image

Grammar:
Int web_image (const char *stepname,, [Extrares,,] last);

return value
Returns Lr_pass (0) on success and returns Lr_fail (1) On failure.

Parameters:
The name that is displayed in the tree view in Stepname:vugen, which can also be used as the name of the transaction in automatic transactions.

List of Attributes (picture of server-side and client-mapped): The SRC attribute is bound to be recorded, and other Alt, Frame, TargetFrame, ordinal are recorded.

1, ALT: Describes the elements of the image. When using the mouse to point to the image, the text hint that emerges.

2. SRC: An element that describes an image, which can be the file name of an image. such as: Button.gif. You can also use SRC/SFX to specify the suffix of an image path. All strings that have the same suffix will be matched to.

3. Frame: The name of the frame where the operation was recorded.

4, TargetFrame: See the list of attributes parameters of the same name.

5. Ordinal: See Web_link parameter with the same name.

List of Attributes (picture of client-side mapping):

1. Areaalt: The alt attribute of the mouse click area.

2. Areaordinal: The sequence number of the mouse click area.

3, MapName: The map name of the image.

List of Attributes (picture of server-side mappings): Although click coordinates are not attributes, they are still used in the format of the property.

1. Xcoord: The x-coordinate when clicking on the image.

2. Ycoord: The y-coordinate when clicking on the image.

Extrares: delimiter, marking the next parameter is a list of resource properties.

List of Resource Attributes: See the list of Resource Attributes section.

Last: The marker at the end of the property list.

Description

Web_image simulates the mouse click action on the specified picture. This function must be used in a context that has a predecessor operation.

In Toos-recording Option, Web_image is recorded when the recording level is set to HMTL-based recording mode.

Web_image supports image mapping for clients (Client-side) and server-side server-side.

In the recording options, under Toos-recording option, the recording option has an advanced HTML option that allows you to set whether to record non-HTML resources and only select the "record within the current scrīpt Step ", the List of Resource attributes will be recorded. Examples of non-HTML resources are GIF and JPG image files.

By modifying the HTTP header, you can pass to the server some request additional information. Using the HTTP header allows the request to contain content as if it were compressed. You can also request only web pages of a specific state.

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

Example

The following example simulates the user clicking on the home icon to return to the home page (boldface section):

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);

The following example simulates a user clicking on a picture on a client map:

Web_image ("Dpt_house.gif",

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

"Mapname=dpt_house",

"Areaordinal=4″,

last);

The following example simulates a user clicking on a picture on a server-side map:

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

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

"Ordinal=1″,

"Xcoord=91″,

"Ycoord=17″,

last);

Here is an example of using a file name suffix: it specifies dpt_house.gif as a suffix, so like. /gifs/dpt_house.gif,/gifs/dpt_house.gif, Gifs/dpt_house.gif,/dpt_house.gif, etc. will be matched to.

Web_image ("Dpt_house.gif",

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

Three. Web_link

Grammar:
Int web_link (const char *stepname,, [Extrares,,] last);

return value
Returns Lr_pass (0) on success and returns Lr_fail (1) On failure.

Parameters:
The name that is displayed in the tree view in the Stepname:vugen is also used as the transaction name in the automatic transaction settings.

List of Attributes: Supports the following properties:

1.Text: Text in hyperlinks must match exactly.

2.Frame: The name of the Frame where the operation was recorded.

3.TargetFrame, Resourcebytelimit: See the list of Attributes section.

4.Ordinal: If the element that is filtered with the given attribute (Attributes) is not unique, then Vugen uses this property to specify one of them. For example: "Src=abc.gif", "ordinal=3" is marked by the SRC value is the 3rd picture of "Abc.gif".

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

Last: End designator.

Description

Simulates a mouse click on a link that is described by several property collections. This function must be executed in the context of the predecessor action.

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

Examples of non-HTML-generated resources are. gif and. jpg images. For the list of Resource attributes parameters, only when recording options–recording–html-based Scrīpt–record within the current scrīpt step When the options are selected, they are inserted into the code.

You can pass some additional information to the server by changing the HTTP header information. Using the HTTP header information allows the response body to contain other content types (Content-type), such as compressed files, or to request a Web page only if a specific state is met.

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

Four. Web_submmit_form

Grammar:
Int web_submit_form (const char *stepname,,, ItemData,, [Extrares,,] last);

return value
Returns Lr_pass (0) on success and returns Lr_fail (1) On failure.

Parameters:
Stepname:form's name. The name that is displayed in the tree view in Vugen, which can also be used as the name of the transaction in automatic transactions.
List of Attributes: Supports the following properties:

The Action property in 1.action:form that specifies the URL used to complete the action in the form. You can also use "action/sfx" to denote all actions that use this suffix.

2.Frame: The name of the Frame where the operation was recorded.

3.TargetFrame, Resourcebytelimit: See List of attributes parameters with the same name.

4.Ordinal: See Web_link parameter with the same name.

Vugen uniquely identifies each form by recording the data field. If this is not sufficient to identify Form,vugen, the Action property is logged. If it is not yet recognized, the ordinal property is logged, in which case the Action property is not logged.

List of Hidden Fields: Supplemental properties (serves). This property allows you to identify a form by using a string of hidden fields. Use the following format:

Starthiddens,

"Name=n1″," Value=v1″, Enditem,

"Name=n2″," Value=v2″, Enditem,

Endhiddens,

List of Data Fields

The data entry is used to identify the form. A form is identified by attributes and data.

Use the following format to represent the data field list

"Name=n1″," Value=v1″, Enditem,

"Name=n2″," Value=v2″, Enditem,

The delimiter for data and attributes in the Itemdata:form.

Extrares: A delimiter that marks the next parameter as a list of resource properties.

List of Resource Attributes: See the list of Resource Attributes section.

Last: The marker at the end of the property list.

Description

The Web_submit_form function is used to submit the form. This function may have to be executed in the context of the previous operation. In Toos-recording Option, Web_image is recorded only if the recording level is set to HMTL-based recording.

In the recording options, under Toos-recording option, the recording option has an advanced HTML option that allows you to set whether to record non-HTML resources and only select the "record within the current scrīpt Step ", the List of Resource attributes will be recorded. Examples of non-HTML resources are GIF and JPG image files.

Typically, if you record the Web_submit_form function, Vugen will record "name" and "value" in the ItemData property. If you do not want to display "value" in clear text in the script, you can encrypt it. Change "value" to "Encryptedvalue" and change the recorded value to the encrypted value.

For example: You can put "Name=grptype", "Value=radroundtrip", Enditem

Instead: "Name=grptype", Encryptedvalue=409e41ebf102f3036b0549c799be3609″, Enditem

If you have installed LoadRunner completely, open the Start menu –mercury Loadrunner-tools–password Encoder, which is used to encrypt strings. Paste the value you want to encrypt into the password column, and then click the Generate button. The encrypted string appears in the encoded string box. Then click the Copy button and paste it into the script to overwrite the original display "Value".

The Lr_decrypt function is used when encrypting another method. Method: Select the entire string, such as "Value=radroundtrip" (note do not select quotation marks), right-click, select Encrypt string, and the script will change to:

"Name=grptype", Lr_decrypt ("40d176c46f3cf2f5fbfaa806bd1bcee65f0371858163″"), Enditem,

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

The above is commonly used when recording, reading, editing, and enhancing scripts for LoadRunner.

Http://www.cnblogs.com/bayonetxxx/archive/2013/01/15/2860729.html

Introduction to common web functions (LoadRunner related)

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.