|
6#
楼主 |
发表于 2006-9-27 16:17:35
|
只看该作者
我已经解决了 ,原来是用web_reg_find将网页返回的固定信息转变成变量,再用来判定。
// 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){
lr_output_message("Log on successful.");
}
else{
lr_error_message("Log on failed");
return(0);
} |
|