51Testing软件测试论坛
标题:
关于web_reg_find(问题又出现了)哭死了
[打印本页]
作者:
kkwwpp
时间:
2009-5-5 11:30
标题:
关于web_reg_find(问题又出现了)哭死了
本来以为解决了,后来发现还是不行。
例如最初录制时,数据库数据为100条。web_reg_find确定网页上有“100条”这几个字符。返回成功
当删除数据库数据后,变为99条,web_reg_find确定网页上有“99条”这几个字符。返回成功
当增加数据后,变为110条, web_reg_find 这个函数就如同失效一样,什么都判断不出来了,每次都返回错误,即使删除数据到100条。
错误提示
Action.c(730): Error -26366: "Text=100条" not found for web_reg_find [MsgId: MERR-26366]
Action.c(730): web_custom_request("TrustDiskAuth-viewer.jsp") highest severity level was "ERROR", 83683 body bytes, 253 header bytes, 92 chunking overhead bytes [MsgId: MMSG-26387]
大家明白吗?
录制了一段查询数据功能的网页,此网页使用的是水晶报表生成的结果。
我从中查找数据条数是否正确。例如网页上写着总共100条。
我用web_reg_find确定网页上有“100条”这几个字符。
但是当结果发生变化时,比如网页上没有100条了,查询出200条时,脚本没有改变,还是web_reg_find查找“100条”这几个字符,结果还是返回成功,能够查询到“100条”。
这是怎么回事啊?!即使清除IE临时文件也不行。
代码如下。大家帮帮忙,看哪错了
蓝色那段是查询代码。
#include "web_api.h"
Action()
{
web_cleanup_cookies();
web_cache_cleanup();
//进行关联
web_set_max_html_param_len("1024");
/* Registering parameter(s) from source task id 3
// {JSESSIONID2} = "B48A393AEADDB524CEF6C8F23CF65890"
// */
web_reg_save_param("JSESSIONID2",
"LB/IC=jsessionid=",
"RB/IC=\"",
"Ord=1",
"RelFrameId=1",
"Search=body",
LAST);
//登陆系统
web_url("trsmconsole",
"URL=http://192.168.16.69:8080/trsmconsole",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_output_message("jesessionid=%s", lr_eval_string("{JSESSIONID2}"));
web_submit_form("Default.do;jsessionid={JSESSIONID2}",
"Snapshot=t2.inf",
ITEMDATA,
"Name=userName", "Value=test", ENDITEM,
"Name=password", "Value=1234567a", ENDITEM,
"Name=imageField.x", "Value=80", ENDITEM,
"Name=imageField.y", "Value=45", ENDITEM,
EXTRARES,
"URL=images/p_bg.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/t_l.htm", ENDITEM,
"URL=trsm/scr192.168.16.69t/tree_dom.js", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/sxicon2.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/base.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/nolines_plus.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/sxicon4.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/empty.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/sxicon3.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
"URL=images/nolines_minus.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/NavigationAction.do", ENDITEM,
LAST);
//进入查询页面
web_url("tab.htm",
"URL=http://192.168.16.69:8080/trsmconsole/trsm/report/tab.htm?LOG_9-1-1-1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/main0.jsp",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
web_url("InstantReportAction.do",
"URL=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/tab.htm?LOG_9-1-1-1",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"URL=../images/top.jpg", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/tab.htm?LOG_9-1-1-1", ENDITEM,
"URL=/trsmconsole/images/on_tabs.jpg", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/tab.htm?LOG_9-1-1-1", ENDITEM,
"URL=/trsmconsole/control/My97DatePicker/skin/WdatePicker.css", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1", ENDITEM,
"URL=../images/index_26.jpg", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1", ENDITEM,
LAST);
//输入参数
web_url("InputParameters.xml",
"URL=http://192.168.16.69:8080/trsmconsole/config/InputParameters.xml",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1",
"Snapshot=t5.inf",
"Mode=HTML",
EXTRARES,
"URL=../control/My97DatePicker/skin/datePicker.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1", ENDITEM,
LAST);
web_url("My97DatePicker.htm",
"URL=http://192.168.16.69:8080/trsmconsole/control/My97DatePicker/My97DatePicker.htm",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1",
"Snapshot=t6.inf",
"Mode=HTML",
EXTRARES,
"URL=skin/datePicker.gif", "Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/InstantReportAction.do?RptType=LOG_9-1-1-1", ENDITEM,
"URL=lang/zh-cn.js", ENDITEM,
"URL=skin/default/datepicker.css", ENDITEM,
"URL=skin/whyGreen/datepicker.css", ENDITEM,
"URL=skin/default/img.gif", ENDITEM,
LAST);
lr_think_time(2);
web_cleanup_auto_headers();
web_cache_cleanup();
//开始查询
web_url("blank.htm",
"URL=http://192.168.16.69:8080/trsmconsole/trsm/report/blank.htm?Operatingtime_BEGIN=2004-04-28%252010%253A32%253A59&Operatingtime_END=2009-05-05%252010%253A32%253A59&ServerRecevingTime_BEGIN=2004-04-28%252010%253A32%253A59&ServerRecevingTime_END=2009-05-05%252010%253A32%253A59&&RptType=LOG_9-1-1-1&winTitle=%u53EF%u4FE1%u79FB%u52A8%u4F7F%u7528%u53F0%u5E10-%u6570%u636E",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t7.inf",
"Mode=HTML",
LAST);
web_custom_request("ReportAction.do",
"URL=http://192.168.16.69:8080/trsmconsole/trsm/report/ReportAction.do?Operatingtime_BEGIN=2004-04-28%252010%253A32%253A59&Operatingtime_END=2009-05-05%252010%253A32%253A59&ServerRecevingTime_BEGIN=2004-04-28%252010%253A32%253A59&ServerRecevingTime_END=2009-05-05%252010%253A32%253A59&&RptType=LOG_9-1-1-1&winTitle=%u53EF%u4FE1%u79FB%u52A8%u4F7F%u7528%u53F0%u5E10-%u6570%u636E&Ajax=true",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/blank.htm?Operatingtime_BEGIN=2004-04-28%252010%253A32%253A59&Operatingtime_END=2009-05-05%252010%253A32%253A59&ServerRecevingTime_BEGIN=2004-04-28%252010%253A32%253A59&ServerRecevingTime_END=2009-05-05%252010%253A32%253A59&&RptType=LOG_9-1-1-1&winTitle=%u53EF%u4FE1%u79FB%u52A8%u4F7F%u7528%u53F0%u5E10-%u6570%u636E",
"Snapshot=t8.inf",
"Mode=HTML",
"EncType=",
"Body= ",
LAST);
web_reg_find("Text=100条",
"Fail=NotFound",
LAST);
//查找网页中是否有“100条”这几个字符
web_url("TrustDiskAuth-viewer.jsp",
"URL=http://192.168.16.69:8080/trsmconsole/trsm/report/TrustDiskAuth-viewer.jsp?RptFile=UsingLogReport.rpt&RptClassName=com.css.waterbox.trsm.businessbean.Auditlog.Data.UsingLogBean&RptTableAlias=UsingLogBean",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/blank.htm?Operatingtime_BEGIN=2004-04-28%252010%253A32%253A59&Operatingtime_END=2009-05-05%252010%253A32%253A59&ServerRecevingTime_BEGIN=2004-04-28%252010%253A32%253A59&ServerRecevingTime_END=2009-05-05%252010%253A32%253A59&&RptType=LOG_9-1-1-1&winTitle=%u53EF%u4FE1%u79FB%u52A8%u4F7F%u7528%u53F0%u5E10-%u6570%u636E",
"Snapshot=t9.inf",
"Mode=HTML",
LAST);
return 0;
}
[
本帖最后由 kkwwpp 于 2009-5-7 11:32 编辑
]
作者:
kkwwpp
时间:
2009-5-5 11:43
作者:
kkwwpp
时间:
2009-5-5 11:56
因为此网页查询的是数据库表的结果。
数据库内容变了,查询的这个值应该也是变化的。
也就是说,当数据库变化了,我这个脚本运行应该是错误的。实际上,运行后,结果是正确的。
作者:
kkwwpp
时间:
2009-5-5 13:50
执行到 web_custom_request("ReportAction.do",
"URL=http://192.168.16.69:8080/trsmcon·····",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://192.168.16.69:8080/trsmconsole/trsm/report/blank.htm?O·····",
"Snapshot=t8.inf",
"Mode=HTML",
"EncType=",
"Body= ",
LAST);
时网页上显示
<result>TrustDiskAuth-viewer.jsp?RptFile=UsingLogReport.rpt&RptClassName=com.css.waterbox.trsm.businessbean.Auditlog.Data.UsingLogBean&RptTableAlias=UsingLogBean</result>
执行到最后一步,
web_url("TrustDiskAuth-viewer.jsp",
网页上面空白,什么都不显示了,没有显示数据表。但是能查询出数据来
作者:
kekangning
时间:
2009-5-5 13:51
web_reg_find属于注册函数,注册一个在web页面中搜索文本字符串的请求,在接下来的Action类函数中执行搜索。此函数仅仅注册请求,并不执行。函数的返回值只表明注册是否成功,并不表示检查的结果。
web_reb_find需要放在检查内容的前面。
作者:
kkwwpp
时间:
2009-5-5 13:52
我怀疑水晶报表的协议不是HTTp的。所以不显示
作者:
kkwwpp
时间:
2009-5-5 13:55
标题:
回复 7# 的帖子
我web_reg_find确实放在了需要检查内容的前面
我需要检查这一步
web_url("TrustDiskAuth-viewer.jsp",
返回的数据的值
作者:
kkwwpp
时间:
2009-5-5 13:58
日志显示web_reg_find 查询成功。能够查到数据Text=1,000。但实际上不是这个数,是Text=1,500
Action.c(186): Registering web_reg_find was successful [MsgId: MMSG-26390]
Action.c(190): Registered web_reg_find successful for "Text=1,000" (count=1) [MsgId: MMSG-26364]
Action.c(190): web_url("TrustDiskAuth-viewer.jsp") was successful, 93561 body bytes, 253 header bytes, 100 chunking overhead bytes [MsgId: MMSG-26385]
Ending action Action.
作者:
Sommelier
时间:
2009-5-5 13:58
没放在检查内容的前面?
作者:
kkwwpp
时间:
2009-5-5 14:04
标题:
回复 11# 的帖子
放在检查内容前面了
作者:
kkwwpp
时间:
2009-5-5 14:22
能检查,不知道为什么不能显示
作者:
kkwwpp
时间:
2009-5-5 14:22
换成URL-based script模式录制后就成功了。但是页面还是空白。
但是数据库更变后,能够查询成功了。
原来是模式的问题
作者:
kkwwpp
时间:
2009-5-5 14:45
1、如果应用是WEB应用,首选是HTML-based方式;
2、如果应用是使用HTTP协议的非WEB应用,首选是URL-based方式;
3、如果WEB应用中使用了java applet程序,且applet程序与服务器之间存在通讯,选用URL-based方式;
4、如果WEB应用中使用的javascrīpt、vbscrīpt脚本与服务器之间存在通讯(调用了服务端组件),选用URL-based方式。
web应用只的事那些应用呢?
作者:
kkwwpp
时间:
2009-5-7 10:34
贴子怎么找不到了
作者:
kkwwpp
时间:
2009-5-7 11:32
作者:
Fin
时间:
2009-5-12 18:15
你的 web_reg_find 函数用法有问题 ,建议你不要手工写了,直接点击右键通过 网页录制框架里自动生成,就OK 。
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2