|
网上找到的关于判断成功登陆的方法:
1、添加成功登陆后的标志,如下的fanhuiflag字段
2、保存判断成功与否的参数,如下的WCSParam_Text1
3、判断登陆是否成功,如下的if语句
问题:
WCSParam_Text1是登陆成功后才取的参数,如果登陆不成功,脚本执行完后,系统就找不到这个参数,提示错误“No match found for the requested parameter "WCSParam_Text1"”,后边的if语句根本就没有执行到。
请问上边的方法对吗,还是我的思路有问题?
Action()
{
char fanhuiflag[30] ="22222";
web_reg_find("Text=\r\n"
"\t图书馆管理系统登录页面\r\n",
LAST);
web_set_max_html_param_len("1024");
/* Registering parameter(s) from source task id 7
// {Siebel_Analytic_ViewState2} = "/wEPDwULLTE5MzA2NTM1MDFkZMhW7tsMnr72dyQw1EWe9oRnEdQl"
// */
web_reg_save_param("Siebel_Analytic_ViewState2",
"LB/IC=ViewState\" value=\"",
"RB/IC=\"",
"Ord=1",
"RelFrameId=1",
"Search=Body",
LAST);
web_url("Login.aspx",
"URL=http://10.*.*.*/LibraryMS/Login.aspx",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
// [WCSPARAM WCSParam_Text1 5 22222] Parameter {WCSParam_Text1} created by Correlation Studio
web_reg_save_param("WCSParam_Text1",
"LB=td>",
"RB=<",
"Ord=94",
"RelFrameId=1",
"Search=Body",
"IgnoreRedirections=Yes",
LAST);
web_submit_data("Login.aspx_2",
"Action=http://10.1.16.89/LibraryMS/Login.aspx",
"Method=POST",
"RecContentType=text/html",
"Referer=http://10.1.16.89/LibraryMS/Login.aspx",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState2}", ENDITEM,
"Name=txtAdmin", "Value=tsoft", ENDITEM,
"Name=txtPwd", "Value=1110", ENDITEM,
"Name=txtCode", "Value=", ENDITEM,
"Name=btnLogin", "Value=鐧诲綍", ENDITEM,
"Name=__EVENTVALIDATION", "Value=/wEWBgLH06DZCwKN8+WYBgKd+7qdDgLChPzDDQKC3IeGDAKQ9M/rBTMz5cP3aLfsQzbX86Jne1ixRdMJ", ENDITEM,
EXTRARES,
"URL=WebResource.axd?d=sQsZ8AfHHfX5j7Lh0K2vYg2&t=633936346575142915", "Referer=http://10.1.16.89/LibraryMS/Default.aspx", ENDITEM,
"URL=WebResource.axd?d=kEe3vR9BO-LC5GNwMzINFw2&t=633936346575142915", "Referer=http://10.1.16.89/LibraryMS/Default.aspx", ENDITEM,
LAST);
if(strcmp(fanhuiflag,lr_eval_string("{WCSParam_Text1}"))!=0)
{
lr_error_message ("登录不成功");
}
return 0;
}
[ 本帖最后由 jiachang 于 2010-8-17 16:16 编辑 ] |
|