web_find("web_find", //定义该查找函数的名称 ,O v6R\t;\5V p0 "RightOf=a", //定义查找字符的右边界 "LeftOf=b", //定义查找字符的左边界 "What=name", //定义查找内容 LAST); |
web_reg_find("Search=Body", //定义查找范围 "SaveCount=ddd", //定义查找计数变量名称 "Text=aaaa", //定义查找内容 LAST); |
// Run the Web Tours sample web_url("MercuryWebTours", "URL=http://localhost/MercuryWebTours/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); // Set up check for successful login by looking for "Welcome" web_reg_find("Text=Welcome", "SaveCount=Welcome_Count", LAST); // Now log in web_submit_form("login.pl", "Snapshot=t2.inf", ITEMDATA, "Name=username", "Value=jojo", ENDITEM, "Name=password", "Value=bean", ENDITEM, "Name=login.x", "Value=35", ENDITEM, "Name=login.y", "Value=14", ENDITEM, LAST); // Check result if (atoi(lr_eval_string("{Welcome_Count}")) > 0){ //判断如果Welcome字符串出现次数大于0 lr_output_message("Log on successful."); }//在日志中输出Log on successful else{ //如果出现次数小于等于 lr_error_message("Log on failed"); //在日志中输出Log on failed return(0); } |
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |