|
我想你说的意思是:如果登录失败,那么事务应该显示是失败的,你可以添加一个文本检查点,然后手工添加事务,对事务加以判断,可以达到你说的目的。以下是我的代码:
Action()
{
web_reg_find("Text=Web Tours Error - Incorrect Password",
"SaveCount=check_count",
LAST);
lr_start_transaction("登录");
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"TargetFrame=body",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value={WCSParam_Diff1}", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=5", ENDITEM,
LAST);
if (atoi(lr_eval_string("{check_count}")) > 0)
lr_end_transaction("登录", LR_FAIL);
else
lr_end_transaction("登录", LR_PASS);
/* if (atoi(lr_eval_string("{check_count}")) > 0){
lr_error_message("Login failed");
return -1;
}
else{
lr_output_message("Login successful.");
return(0);
}
*/
return 0;
} |
|