pacey_peng 发表于 2014-3-11 11:01:55

检查点问题【新手】: 用固定用户和密码登录,检查点为什么返回的num仍是0?

Action()
{



lr_rendezvous("login");


lr_start_transaction("check_login");


lr_think_time(21);


web_reg_find("Search=Body","SaveCount=num","Text=欢迎您", LAST);




web_submit_data("UserLogin",

"Action=http://192.168.1.114:8800/cgi/user/UserLogin?function=UserLogin&userType=1",

"Method=POST",

"RecContentType=text/html",

"Referer=http://192.168.1.114:8800/secure/user/login.jsp?retUrl=%2Fcgi%2Fqhfax%2Finvest%2FProductAction%3Ffunction%3DGetMyAccountInfo%26menu_id=401%26mark=3%26login=login",

"Snapshot=t9.inf",

"Mode=HTML",

ITEMDATA,

"Name=retUrl", "Value=/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login", ENDITEM,

"Name=userName", "Value=test_01", ENDITEM,

"Name=userPwd", "Value=123456a", ENDITEM,

LAST);


       lr_output_message("登录用户名:%s", lr_eval_string("{username}"));




web_url("ProductAction",

"URL=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login",

"Resource=0",

"RecContentType=text/html",

"Referer=http://192.168.1.114:8800/secure/user/login.jsp?retUrl=%2Fcgi%2Fqhfax%2Finvest%2FProductAction%3Ffunction%3DGetMyAccountInfo%26menu_id=401%26mark=3%26login=login",

"Snapshot=t10.inf",

"Mode=HTML",

LAST);


web_add_cookie("Hm_lpvt_4c5947cd21b22c2401340b46429e3893=1394438973; DOMAIN=192.168.1.114");


web_url("loginInfo.jsp_3",

"URL=http://192.168.1.114:8800/include/loginInfo.jsp?random=0.4661151359708332",

"Resource=0",

"RecContentType=text/html",

"Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login",

"Snapshot=t11.inf",

"Mode=HTML",

EXTRARES,

"Url=http://hm.baidu.com/h.js?4c5947cd21b22c2401340b46429e3893", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login", ENDITEM,

"Url=../js/tipDiv.js?_v=%3C%=_v%%3E&_=1394438973292", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login", ENDITEM,

"Url=http://hm.baidu.com/hm.gif?cc=1&ck=1&cl=24-bit&ds=1366x768&ep=1004%2C1004&et=3&fl=12.0&ja=1&ln=zh-CN&lo=0&lt=1394438947&nv=0&rnd=221870668&si=4c5947cd21b22c2401340b46429e3893&st=4&v=1.0.56&lv=3&tt=%E4%BA%92%E8%81%94%E7%BD%91%E9%87%91%E8%9E%8D%E6%8A%95%E8%B5%84%E9%A6%96%E9%80%89P2P%E7%BD%91%E8%B4%B7%E5%B9%B3%E5%8F%B0%E3%80%90%E5%89%8D%E9%87%91%E6%89%80%E3%80%91&u=http%3A%2F%2F192.168.1.114%3A8800%2F", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&"

"menu_id=401&mark=3&login=login", ENDITEM,

"Url=http://hm.baidu.com/hm.gif?cc=1&ck=1&cl=24-bit&ds=1366x768&et=0&fl=12.0&ja=1&ln=zh-CN&lo=0&lt=1394438947&nv=1&rnd=338737591&si=4c5947cd21b22c2401340b46429e3893&st=1&v=1.0.56&lv=3&tt=%E4%BA%92%E8%81%94%E7%BD%91%E9%87%91%E8%9E%8D%E6%8A%95%E8%B5%84%E9%A6%96%E9%80%89P2P%E7%BD%91%E8%B4%B7%E5%B9%B3%E5%8F%B0%E3%80%90%E5%89%8D%E9%87%91%E6%89%80%E3%80%91&u=http%3A%2F%2F192.168.1.114%3A8800%2F", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark="

"3&login=login", ENDITEM,

"Url=../js/jquery/jquery-ui.js?_v=%3C%=_v%%3E&_=1394438973456", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login", ENDITEM,

"Url=http://hm.baidu.com/hm.gif?cc=1&ck=1&cl=24-bit&ds=1366x768&et=0&fl=12.0&ja=1&ln=zh-CN&lo=0&lt=1394438947&nv=0&rnd=1785419825&si=4c5947cd21b22c2401340b46429e3893&st=4&su=http%3A%2F%2F192.168.1.114%3A8800%2Fsecure%2Fuser%2Flogin.jsp%3FretUrl%3D%252Fcgi%252Fqhfax%252Finvest%252FProductAction%253Ffunction%253DGetMyAccountInfo%2526menu_id%3D401%2526mark%3D3%2526login%3Dlogin&v=1.0.56&lv=3", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark="

"3&login=login", ENDITEM,

"Url=../js/tipDiv.js?_v=%3C%=_v%%3E&_=1394438973601", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login", ENDITEM,

"Url=../js/jquery/jquery-ui.js?_v=%3C%=_v%%3E&_=1394438973646", "Referer=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login", ENDITEM,

LAST);


lr_end_transaction("check_login",LR_AUTO);




if(atoi(lr_eval_string("{num}"))>0)

lr_output_message("登录成功");

else

lr_output_message("登录失败");


return 0;
}

看了很多前辈的帖子,都说是编码问题,但测试网站编码为utf-8,录制选项也设置了,检查点改为英文,num值仍返回0,求大侠指点~~~

ares444 发表于 2014-3-11 15:50:33

你点下“tree”视图,检查下服务端返回的响应报文,里面中文字符应该是乱码,字符集应该不一样的。你应该转码下。
具体方法参考这个例子;
//将“百度”两个字,转换成UTF-8格式
        lr_convert_string_encoding( "百度",
                LR_ENC_SYSTEM_LOCALE,
                LR_ENC_UTF8,
                "str" );
//由于lr_convert_string_encoding的输出结果后面会多一个\X00,因此需要使用lr_save_string去掉\X00
        lr_save_string( lr_eval_string("{str}"),
                "str" );
        web_reg_find("Text={str}",
                "Search=body",
                LAST);

pacey_peng 发表于 2014-3-11 17:06:58

回复 2# ares444


    你好,谢谢你的回答,我按照你给的例子试了一下,打印出来怎么是乱码呀?如图:

pacey_peng 发表于 2014-3-14 17:48:42

各位大侠们,救救急啊,我把检查内容改为非中文,为什么还是检查不到呢?

haihai1005 发表于 2014-3-17 14:53:54

你把
web_reg_find("Search=Body","SaveCount=num","Text=欢迎您", LAST);
放到 这个前面呢!

web_url("ProductAction",

"URL=http://192.168.1.114:8800/cgi/qhfax/invest/ProductAction?function=GetMyAccountInfo&menu_id=401&mark=3&login=login",

"Resource=0",

"RecContentType=text/html",

"Referer=http://192.168.1.114:8800/secure/user/login.jsp?retUrl=%2Fcgi%2Fqhfax%2Finvest%2FProductAction%3Ffunction%3DGetMyAccountInfo%26menu_id=401%26mark=3%26login=login",

"Snapshot=t10.inf",

"Mode=HTML",

LAST);

pacey_peng 发表于 2014-3-18 18:13:28

回复 5# haihai1005


    试过了,不行,我重新录制了一个访问网站首页的脚本,也是检查点返回的num为0

Action()
{





lr_rendezvous("select");


lr_start_transaction("check_select");


web_reg_find("Search=Body","SaveCount=num","Text=XD140328001",LAST);


web_url("coba_official_v2.json",

"URL=http://i.g-fox.cn/notification/coba_official_v2.json",

"Resource=1",

"RecContentType=application/json",

"Referer=",

"Snapshot=t1.inf",

LAST);


web_url("tk.gif",

"URL=http://addons.g-fox.cn/tk.gif?when=run&r=0.21220241754892255",

"Resource=1",

"RecContentType=image/gif",

"Referer=",

"Snapshot=t2.inf",

LAST);
/*

web_add_cookie("Hm_lvt_4c5947cd21b22c2401340b46429e3893=1394008517,1394103421,1394103901; DOMAIN=192.168.1.114");


web_add_cookie("BAIDUID=A014660289C9EF9C1385C7E94C1D5E93:FG=1; DOMAIN=hm.baidu.com");


web_add_cookie("HMACCOUNT=1EB151A499412662; DOMAIN=hm.baidu.com");
*/

web_url("192.168.1.114:8800",

"URL=http://192.168.1.114:8800/",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t3.inf",

"Mode=HTML",

EXTRARES,

"Url=http://addons.g-fox.cn/ntab.gif?c=ntab&t=homepagereset&a=notify&d=3&f=&r=0.02017064691199677&cid=firefox.latest", "Referer=", ENDITEM,

"Url=http://hm.baidu.com/h.js?4c5947cd21b22c2401340b46429e3893", ENDITEM,

"Url=http://hm.baidu.com/hm.gif?cc=1&ck=1&cl=24-bit&ds=1366x768&et=0&fl=12.0&ja=1&ln=zh-CN&lo=0&lt=1394419570&nv=1&rnd=777488114&si=4c5947cd21b22c2401340b46429e3893&st=1&v=1.0.56&lv=2&tt=%E4%BA%92%E8%81%94%E7%BD%91%E9%87%91%E8%9E%8D%E6%8A%95%E8%B5%84%E9%A6%96%E9%80%89P2P%E7%BD%91%E8%B4%B7%E5%B9%B3%E5%8F%B0%E3%80%90%E5%89%8D%E9%87%91%E6%89%80%E3%80%91", ENDITEM,

LAST);


web_add_cookie("uid=38oGFVMWnrc5jGzuEswUAg==; DOMAIN=i.firefoxchina.cn");


web_url("loginInfo.jsp",

"URL=http://192.168.1.114:8800/include/loginInfo.jsp?random=0.9495014854563584",

"Resource=0",

"RecContentType=text/html",

"Referer=http://192.168.1.114:8800/",

"Snapshot=t4.inf",

"Mode=HTML",

EXTRARES,

"Url=http://i.firefoxchina.cn/bookmarks/updates-0.json", "Referer=", ENDITEM,

"Url=http://i.firefoxchina.cn/newtab/master-i/quickdialdata-0.json", "Referer=", ENDITEM,

"Url=../investment/css/index_new.css", "Referer=http://192.168.1.114:8800/secure/user/iframeLogin.jsp", ENDITEM,

"Url=../investment/css/account.css", "Referer=http://192.168.1.114:8800/secure/user/iframeLogin.jsp", ENDITEM,

"Url=../investment/css/invest.css", "Referer=http://192.168.1.114:8800/secure/user/iframeLogin.jsp", ENDITEM,

"Url=../servlet/buildimageservlet?new%20Date().getTime()", "Referer=http://192.168.1.114:8800/secure/user/iframeLogin.jsp", ENDITEM,

"Url=http://adu.g-fox.cn/adu.gif?channelid=firefox.latest&fxversion=27.0.1&ceversion=2013.7&ver=2_2&pk=%7B596f4da5-1f0b-4fdf-8d75-5b096b6306af%7D&uk=%7B60b4ff1a-73b4-4f95-b931-c61bdafe011b%7D&cehome=false&locale=zh-CN&moexts=quicklaunch,share_all_cn,tabimprovelite,coba,easyscreenshot,cemigration,cpmanager,cehomepage,commonfix,semodifier,account&age=80&default=false&flash=12.0.0.70&now=1394419567942", "Referer=", ENDITEM,

"Url=http://adu.g-fox.cn/adu-new.gif?ver=2_2&now=1394419567943&channelid=firefox.latest&fxversion=27.0.1&ceversion=2013.7&locale=zh-CN&age=80&pk=%7B596f4da5-1f0b-4fdf-8d75-5b096b6306af%7D&uk=%7B60b4ff1a-73b4-4f95-b931-c61bdafe011b%7D&ude=true&default=false&cehome=false&flash=12.0.0.70&moexts=quicklaunch:0.14,share_all_cn:0.16,tabimprovelite:1.7.27,coba:1.0.22,easyscreenshot:1.0,cemigration:27.1,cpmanager:1.0.19,cehomepage:0.9.25.15,commonfix:0.7,semodifier:0.2,account:1.0.10", "Referer=", ENDITEM,

LAST);
/*

web_add_cookie("Hm_lvt_4c5947cd21b22c2401340b46429e3893=1394008517,1394103421,1394103901,1394419570; DOMAIN=192.168.1.114");


web_add_cookie("Hm_lpvt_4c5947cd21b22c2401340b46429e3893=1394419570; DOMAIN=192.168.1.114");
*/

web_url("favicon.ico",

"URL=http://192.168.1.114:8800/favicon.ico",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t5.inf",

"Mode=HTML",

LAST);

/*

web_add_cookie("PREF=ID=7e90d4f0a349f76e:TM=1393578739:LM=1393578739:S=Fje7hTtWq9Odg3s5; DOMAIN=safebrowsing.clients.google.com");


web_add_cookie("PREF=ID=7e90d4f0a349f76e:TM=1393578739:LM=1393578739:S=Fje7hTtWq9Odg3s5; DOMAIN=safebrowsing-cache.google.com");
*/

lr_think_time(44);


web_custom_request("downloads",

"URL=http://safebrowsing.clients.google.com/safebrowsing/downloads?client=navclient-auto-ffox&appver=27.0.1&pver=2.2&wrkey=AKEgNivhDe-vemwEW3KHdyzceLP-zfBLPtRoh1fa3o8yaoL4R28GQF9PrhljYCEvq-Pg1EaxKj331unMYWEX48zjXTwWrWCjWA==",

"Method=POST",

"Resource=0",

"RecContentType=application/vnd.google.safebrowsing-update",

"Referer=",

"Snapshot=t6.inf",

"Mode=HTML",

"EncType=text/plain",

"Body=goog-malware-shavar;a:134170-137548:s:126969-132515:mac\ngoog-phish-shavar;a:311707-315976:s:156208-159981:mac\n",

EXTRARES,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChNnb29nLW1hbHdhcmUtc2hhdmFyEAEYgYsIIICQCCo-NgYCAP___________________________________________________________________________wcyG4EFAgD_____________________________Hw", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChNnb29nLW1hbHdhcmUtc2hhdmFyEAAY4bEIIICzCDIZ4RgCAP____3_____________________AA", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChNnb29nLW1hbHdhcmUtc2hhdmFyEAAYgbMIIIC4CCo9OxoCAP__________________________________________________________________________PzIcgRkCAP______________________________Aw", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchABGNnhCSCA4gkyCtlwAgD______wA", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchABGIHiCSCA7AkqigHWcQIA_________________________________________________________________________________________________________________________________________________________________________________wcyHwFxAgD__________________________________x8", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchAAGLmkEyDgpBMyCjnSBAD______wA", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchAAGOGkEyCwpRMyD2HSBAD_____________AA", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchAAGLGlEyCAphMyD7HSBAD_____________AA", "Referer=", ENDITEM,

"Url=http://safebrowsing-cache.google.com/safebrowsing/rd/ChFnb29nLXBoaXNoLXNoYXZhchAAGIGmEyCAsBMqnAFD0wQA_________________________________________________________________________________________________________________________________________________________________________________________________________z8yDQHTBAD___v______wM", "Referer=", ENDITEM,

"Url=http://i.firefoxchina.cn/cclv/v1/hosts.json", "Referer=", ENDITEM,

LAST);



   lr_log_message("num:%s",lr_eval_string("{num}"));


if(atoi(lr_eval_string("{num}"))>0)

lr_output_message("访问成功");

else

lr_output_message("访问失败");



lr_end_transaction("check_select",LR_AUTO);


return 0;
}

zjj919916190 发表于 2014-3-31 17:26:40

是不是请求响应超时了

alwans 发表于 2014-4-7 14:28:00

返回0 说明没出现“欢迎”用web_submit_data 的时候 session不需要做关联?
页: [1]
查看完整版本: 检查点问题【新手】: 用固定用户和密码登录,检查点为什么返回的num仍是0?