How to use Web_reg_find in LoadRunner

Source: Internet
Author: User

Java syntax: int object. Reg_find (String text, string[] argumentlist ); (Example: slightly)

c Syntax: int web_reg_find(const char *attribute_list, last);

Example 1 search text string "World", if not searched, the function search fails, the script stops executing:

Web_url ("My97datepicker.html_2",
"Url=http://www.****/thirdparty/my97datepicker/my97datepicker.html",
"Resource=0",
"Reccontenttype=text/html",
"Referer=http://www.****/jjh/dacms/login.do;jsessionid=f3678ee7651a87be80de3e7de449913c",
"Snapshot=t5.inf",
"Mode=html",
Extrares,
"Url=lang/zh-cn.js", Enditem,
"Url=skin/whygreen/datepicker.css", Enditem,
"Url=skin/default/datepicker.css", Enditem,
"Url=skin/default/img.gif", Enditem,
last);

Web_reg_find("Text=world",


    web_submit_data ("Login.do",
         "action=http:// Www.****/jjh/dacms/login.do ",
        " Method=post ",
          "reccontenttype=text/html",
         referer=http://www.****/ jjh/dacms/login.do;jsessionid=f3678ee7651a87be80de3e7de449913c ",
        " Snapshot=t6.inf ",
        " mode=html ",
         ItemData,
         "Name=username", "value=****", Enditem,
          "Name=password", "value=****", Enditem,
         "Name=submit.x" , "value=32", Enditem,
         "Name=submit.y", "value=16", Enditem,
         last);

The failure prompt information is:

ACTION.C: Error-26366: "Text=world" not found for Web_reg_find [msgid:merr-26366]
ACTION.C: Web_submit_data ("login.do") highest severity level was "ERROR", 4261 body bytes, 315 header bytes, Chunki ng overhead bytes [msgid:mmsg-26387]

Example 2

Example 2 is the same as Example 1, but because Savecount is used, script execution does not stop on failure. Instead, the error is handled in the code.

Web_url ("My97datepicker.html_2",
"Url=http://www.****/thirdparty/my97datepicker/my97datepicker.html",
"Resource=0",
"Reccontenttype=text/html",
"Referer=http://www.****/jjh/dacms/login.do;jsessionid=f3678ee7651a87be80de3e7de449913c ",
"Snapshot=t5.inf",
"Mode=html",
Extrares,
"Url=lang/zh-cn.js", Enditem,
"Url=skin/whygreen/datepicker.css", Enditem,
"Url=skin/default/datepicker.css", Enditem,
"Url=skin/default/img.gif", Enditem,
last);

Web_reg_find("Text=world",
"Savecount=world_count",
last);

if (Atoi (lr_eval_string ("{world_count}")) > 0) {
Lr_output_message ("Log on successful.");
}

else{
Lr_output_message ("Output:log on Failed");
Lr_error_message ("Log on failed");
return (0);
}

Web_submit_data ("Login.do",
"Action=http://www.****/jjh/dacms/login.do ",
"Method=post",
"Reccontenttype=text/html",
"Referer=http://www.****/jjh/dacms/login.do;jsessionid=f3678ee7651a87be80de3e7de449913c ",
"Snapshot=t6.inf",
"Mode=html",
ItemData,
"Name=username", "value=****", Enditem,
"Name=password", "value=****", Enditem,
"Name=submit.x", "value=32", Enditem,
"Name=submit.y", "value=16", Enditem,
last);

The prompt result information is:

ACTION.C: Output:log on failed
ACTION.C (Bayi): Error:log on failed
Ending action action.
Error-27257:pending WEB_REG_SAVE_PARAM/REG_FIND/CREATE_HTML_PARAM[_EX] Request (s) detected and reset at the end of the Itera tion number 1 [msgid:merr-27257]

Example 3

Search for the text string "error", If the string is found, it fails and the script execution stops.

Web_reg_find ("Text/ic=error", "Fail=found", last);

Web_url ("Step", "url= ...", last);

Example 4

The string "World" is searched, and if the text string is not searched, the script executes the action spider, and if the text string is searched 1 or more times, the script executes action honeybee.

Web_reg_find ("Text=world", "Savecount=world_count", last);

Web_url ("Step", "url= ...", last);

if (strcmp (lr_eval_string ("{world_count}"), "0") = = 0)

Action Spider

Else

Action Honeybee

How to use Web_reg_find in LoadRunner

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.