1.函數(shù)定義
該函數(shù)的作用是“在緩存中查找相應(yīng)的內(nèi)容”,常用參數(shù)及含義如下:
LAST);
2)在該函數(shù)的參數(shù)中有個“SaveCount”,該參數(shù)可以記錄在緩存中查找內(nèi)容出現(xiàn)的次數(shù),我們可以使用該值,來判斷要查找的內(nèi)容是否被找到,下面舉個例子來說明:(實際測試中的例子)
Action()
{
lr_think_time(13);
lr_rendezvous('login'); /*設(shè)定登陸操作的集合點*/
web_custom_request('login',
'URL=http://192.168.1.230/webservice/ece/login/login?account={usename}&password=123456&dateTime=1486713296375',
'Method=GET',
'TargetFrame=',
'Resource=1',
'RecContentType=application/json',
'Referer=http://192.168.1.230/jsp/login/login.jsp',
'Snapshot=t67.inf',
'EncType=application/json',
LAST);
lr_start_transaction('login_submit_time'); /*該事務(wù)點的作用是統(tǒng)計登陸成功的信息*/
web_reg_find('Fail=NotFound', /*增加文本檢查點,驗證是否登錄成功*/
'Search=All',
'Text=EXIT',
'SaveCount=para_count', /*檢查到文本的數(shù)量存在para_count這個變量中*/
LAST);
web_url('pr1.jsp',
'URL=http://192.168.1.230/jsp/login/pr1.jsp',
'TargetFrame=',
'Resource=0',
'RecContentType=text/html',
'Referer=http://192.168.1.230/jsp/login/login.jsp',
'Snapshot=t68.inf',
'Mode=HTML',
EXTRARES,
'URL=/images/ICOindex.png', ENDITEM,
'URL=/images/fxBJD.gif', ENDITEM,
'URL=/images/fxBJBD.gif', ENDITEM,
LAST);
lr_end_transaction('login_submit_time', LR_AUTO);
lr_log_message('用戶名:%s', lr_eval_string('{usename}'));
if(strcmp(lr_eval_string('{para_count}'),'0')==0)
lr_log_message('登陸失??!');
else
lr_log_message('登陸成功!');
return 0;
}
4.與web_find的區(qū)別
1.web_find是從界面中查找,web_reg_find是從源代碼中(緩存)查找,對代碼不熟悉建議在樹形結(jié)構(gòu)中添加檢查點,文本檢查點消耗一定的系統(tǒng)資源所有LR默認(rèn)是關(guān)閉的,添加文本檢查點后需要手動打開(run-time seing-Preferences-Enable Image and text chek)WEB_FIND使用時必須開啟內(nèi)容檢查選項,而WEB_REG_FIND則不沒有此限制
2.這兩個函數(shù)函數(shù)類型不同,WEB_FIND是普通函數(shù),WEB_REG_FIND是注冊函數(shù)