???????????
??????LR??????????????????????????????????????????????????????????????????????? ????????????????????????????????????????á?
????????????????????????????????????????????????????????д?????????????????????п???????????????????????????????????????ж??????????в???????????????????????ж???????????????LR?????????????????????????????????????????????????????????????????£???????????????????????????????????????????????????????????????????????????????????pass????????????????
?????????? ???????????????????????????????????controller??????????analysis??????С??????LR?к???API?????????????????????н?????????????web_find?????????鵽?????????????????LR_FAIL????????????????FAIL???????????????LR_PASS????????????PASS??
??????????????????VuGen?в???Text/Image????VuGen?а???Tree view??script view????????????????????????script view????????????????????????tree view???2???????????????????????λ????????????????text check??image check???????????????????????????web_find??web_reg_find????????????????2???????????????????????????????
???????web_find??????
????????????????????
????web_find("web_find"??//??????????
????"RightOf=go to"??//????????????????
????"LeftOf=page"??//????????????????
????"What=home"??//???????????????
????LAST);
?????ú?????????????????в??????????????м????????????
????1?????????HTML???????????в???
????2???ú???????????????????????????????в????????ú???????д????????????????????
????3?????????????????????run-tim setting->preferences??棬??enable image and text check???????У???????иò??????
????4????VB??java???в????ú???
????5?????Ч?????????????????????????????ж????????????????????????????????????????????????????????????
?????????裺????????????tree view->????????????λ?????????insert after->???????web checks/text check->????????????specification????????ü???????????????3???????->????л???general???????????ò???????????????????????
???????????????????????3???????
????a.search for??????????????????????????ABC??????????????в???????
????b.right of?????????????????????            c.left of?????????????????????
????????web_reg_find??????
?????ú???????????в?????????????????????????????д?????????????????????????????д??????6???????? ??web_custom_request()??web_image()??web_link??web_submit_data()??web_submit_form()??web_url()??
??????web_find????????
????1??web_find?????????????????web_reg_find??????????
????2??web_find?????????????????????????web_reg_find??????д?????
????3??web_find??????????????HTML?????????У???web_reg_find??????д?????
????4??web_find????????????????н?????????????web_reg_find????????????н??в???
????5??web_reg_find?????????Ч???????web_find??????
?????????裺????????????tree view->????????????λ?????????insert after??insert before?????1?????->???????services/web_reg_find->????????????????ü?????????????2???????


????
?1?????????????λ???


????
?2???????????????????

???????????????Χ???????3?????????????????????????????п?????????????LR??????????????????????????????????????????????????response body?п????????????????????test1?????????鷶Χ??????body????????????????????д???????????????body?е??


????
?3????????????????

????????????????????
web_reg_find("Search=Body"??//????????Χ
"SaveCount=num"??//????????????????
"Text=home"??//??????????????
LAST);
web_submit_data("login.pl"??
"Action=http://127.0.0.1:1080/WebTours/login.pl"??
"Method=POST"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home"??
"Snapshot=t15.inf"??
"Mode=HTTP"??
ITEMDATA??
"Name=userSession"?? "Value=120746.88035642zcVAQVHpzfiDDDDDDHczfpfAfQf"?? ENDITEM??
"Name=username"?? "Value=test1"?? ENDITEM??
"Name=password"?? "Value=test"?? ENDITEM??
"Name=JSFormSubmit"?? "Value=off"?? ENDITEM??
"Name=login.x"?? "Value=52"?? ENDITEM??
"Name=login.y"?? "Value=11"?? ENDITEM??
LAST);
if(atoi(lr_eval_string("{num}"))>=1{
lr_end_transaction("login"??LR_PASS);//login??????????????????????????????????????????????????????LR_PASS
}
else{
lr_end_transaction("login"??LR_FAIL);//?????????????LR_FAIL
}
????????web_image_check??????
?????????裺????????????tree view->????????????λ?????????insert after??insert before->???????web checks/image check->????????????specification????????ü?????????????4?????->????л???general???????????ò???????????????????????
???????web?????а?????JS??????????tree view???????????????????????????????tool->general options->correlation???->???enable scripting and java apples on snapshots viewer??


????
?4??image?????????????

????????????
????????????????
????1??????????????????

?????????????????У?????????????????????仯??????????????????????????й?????????????????????????ɡ?
????2??LR??ù??????????к????????λ????Щ???????????LR??????????????
??????????Щ??????????????????????????????????仯???????????????????λ??????????????????????????????????????仯?????LR?????????????????????????????????????????????????????????β????????????????硣
????????3?????????
???????????????????HTML????????tree view???????????????????????url?????????????????????????????????web_find??????????????????????????????????URL????????????
????1??????й???
????VuGen????????????棬???????????????????????????????????????????????
????1????????????????????????????????????????????????????????????????????л??????????????????????????????????磬????????????????????硣
????a.??????????????????????? tools->recording options->http properties->correlation ???????????
????b.???????????????????????????????????????壬???5?????


????
?5?????????????

????c.?6???????????????????????????????в???????????????????????


????
?6?????????????

????2????????á?????????????????????????5????????enable correlation during recording???????????У???VuGen??鵽??????????????????????????趨???????????????????????????web_reg_param????????????????£?
Action()
{
//????????洢????????????
web_set_max_html_param_len("1024");
web_url("WebTours"??
"URL=http://127.0.0.1:1080/WebTours"??
"Resource=0"??
"RecContentType=text/html"??
"Referer="??
"Snapshot=t2.inf"??
"Mode=HTTP"??
LAST);
web_url("header.html"??
"URL=http://127.0.0.1:1080/WebTours/header.html"??
"Resource=0"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/"??
"Snapshot=t3.inf"??
"Mode=HTTP"??
LAST);
web_concurrent_start(NULL);
web_url("hp_logo.png"??
"URL=http://127.0.0.1:1080/WebTours/images/hp_logo.png"??
"Resource=1"??
"RecContentType=image/png"??
"Referer=http://127.0.0.1:1080/WebTours/header.html"??
"Snapshot=t4.inf"??
LAST);
web_url("webtours.png"??
"URL=http://127.0.0.1:1080/WebTours/images/webtours.png"??
"Resource=1"??
"RecContentType=image/png"??
"Referer=http://127.0.0.1:1080/WebTours/header.html"??
"Snapshot=t5.inf"??
LAST);
web_concurrent_end(NULL);
web_url("welcome.pl"??
"URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"??
"Resource=0"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/"??
"Snapshot=t9.inf"??
"Mode=HTTP"??
LAST);
web_url("home.html"??
"URL=http://127.0.0.1:1080/WebTours/home.html"??
"Resource=0"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"??
"Snapshot=t12.inf"??
"Mode=HTTP"??
LAST);
//??????????????web_reg_save_param???????????????????????
/* Registering parameter(s) from source task id 53
// {BL2} = "120705.245200486zcAiHHzpAfDHcfcpzfzD"
// */
web_reg_save_param("BL2"?? //BL????????????????????????????????BL2????????????????????
"LB/IC=userSession value="?? //LB?????????IC???????Сд
"RB/IC=>"?? //RB???????
"Ord=1"?? //??????????????λ???????1???????????????????γ?????????
"Search=Body"??//?????Χ
"RelFrameId=1"?? //?ID??????????????ID??????????????
LAST);
web_url("nav.pl"??
"URL=http://127.0.0.1:1080/WebTours/nav.pl?in=home"??
"Resource=0"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"??
"Snapshot=t14.inf"??
"Mode=HTTP"??
LAST);
web_url("mer_login.gif"??
"URL=http://127.0.0.1:1080/WebTours/images/mer_login.gif"??
"Resource=1"??
"RecContentType=image/gif"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home"??
"Snapshot=t15.inf"??
LAST);
web_concurrent_start(NULL);
web_url("8afc2fe48db9060fe1bdda2089e1d950.png"??
"URL=http://act.cmcmcdn.com/upload/201507/8afc2fe48db9060fe1bdda2089e1d950.png"??
"Resource=1"??
"RecContentType=image/png"??
"Referer=http://127.0.0.1:1080/WebTours/"??
"Snapshot=t16.inf"??
LAST);
web_url("3b491068507d8f85ea7b35d756da7215.png"??
"URL=http://act.cmcmcdn.com/upload/201507/3b491068507d8f85ea7b35d756da7215.png"??
"Resource=1"??
"RecContentType=image/png"??
"Referer=http://127.0.0.1:1080/WebTours/"??
"Snapshot=t17.inf"??
LAST);
web_concurrent_end(NULL);
lr_start_transaction("login");
lr_think_time(13);
web_submit_data("login.pl"??
"Action=http://127.0.0.1:1080/WebTours/login.pl"??
"Method=POST"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home"??
"Snapshot=t18.inf"??
"Mode=HTTP"??
ITEMDATA??
"Name=userSession"?? "Value={BL2}"?? ENDITEM?? //??????????????????????BL2??????????value???????????????BL2??????
"Name=username"?? "Value=test1"?? ENDITEM??
"Name=password"?? "Value=test1"?? ENDITEM??//password?????????????????? "we find the string!";??????????????"sorry??don't find the string!"
"Name=JSFormSubmit"?? "Value=off"?? ENDITEM??
"Name=login.x"?? "Value=0"?? ENDITEM??
"Name=login.y"?? "Value=0"?? ENDITEM??
LAST);
web_concurrent_start(NULL);
web_url("nav.pl_2"??
"URL=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"??
"Resource=0"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/login.pl"??
"Snapshot=t19.inf"??
"Mode=HTTP"??
LAST);
//???????
web_reg_find("Search=Body"??//?????????Χ
"SaveCount=username"??//?????username??????????test1
"Text/DIG=test1"??//?????????
LAST);
web_url("login.pl_2"??
"URL=http://127.0.0.1:1080/WebTours/login.pl?intro=true"??
"Resource=0"??
"RecContentType=text/html"??
"Referer=http://127.0.0.1:1080/WebTours/login.pl"??
"Snapshot=t20.inf"??
"Mode=HTTP"??
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("flights.gif"??
"URL=http://127.0.0.1:1080/WebTours/images/flights.gif"??
"Resource=1"??
"RecContentType=image/gif"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"??
"Snapshot=t21.inf"??
LAST);
web_url("itinerary.gif"??
"URL=http://127.0.0.1:1080/WebTours/images/itinerary.gif"??
"Resource=1"??
"RecContentType=image/gif"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"??
"Snapshot=t22.inf"??
LAST);
web_url("in_home.gif"??
"URL=http://127.0.0.1:1080/WebTours/images/in_home.gif"??
"Resource=1"??
"RecContentType=image/gif"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"??
"Snapshot=t23.inf"??
LAST);
web_url("signoff.gif"??
"URL=http://127.0.0.1:1080/WebTours/images/signoff.gif"??
"Resource=1"??
"RecContentType=image/gif"??
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"??
"Snapshot=t24.inf"??
LAST);
web_concurrent_end(NULL);
//?ж??????????
if (atoi(lr_eval_string("{username}"))>0){//?ж????username????????????????????????????1
lr_output_message("we find the string!");//???????0??????we find the string!
}
else{
lr_output_message("sorry??don't find the string!");//????????sorry??don't find the string!
}
lr_end_transaction("login"??LR_AUTO);//??????????????????LR_AUTO
return 0;
}