51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4659|回复: 7
打印 上一主题 下一主题

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

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2014-3-11 11:01:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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,求大侠指点~~~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 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);
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2014-3-11 17:06:58 | 只看该作者
回复 2# ares444


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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2014-3-14 17:48:42 | 只看该作者
各位大侠们,救救急啊,我把检查内容改为非中文,为什么还是检查不到呢?
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 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);
回复 支持 反对

使用道具 举报

该用户从未签到

6#
 楼主| 发表于 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("REF=ID=7e90d4f0a349f76e:TM=1393578739M=1393578739:S=Fje7hTtWq9Odg3s5; DOMAIN=safebrowsing.clients.google.com");


web_add_cookie("REF=ID=7e90d4f0a349f76e:TM=1393578739M=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;
}
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2014-3-31 17:26:40 | 只看该作者
是不是请求响应超时了
回复 支持 反对

使用道具 举报

该用户从未签到

8#
发表于 2014-4-7 14:28:00 | 只看该作者
返回0 说明没出现“欢迎”  用web_submit_data 的时候 session不需要做关联?
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-26 19:43 , Processed in 0.079716 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表