51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

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

[原创] web_reg_find函数为何总返回值为0,高手帮我分析下我错在哪了

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-3-5 14:15:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
代码如下:
Action()
{
web_reg_find("Search=Body",
                         "SaveCount=a_count",
                         "Text=星期一",LAST);


        web_submit_data("login!login.action",
                "Action=http://172.17.192.1:8080/test/login!login.action",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://172.17.192.1:8080/test/login1024.jsp",
                "Snapshot=t3.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=screenSize", "Value=1024", ENDITEM,
                "Name=loginId", "Value=liujf", ENDITEM,
                "Name=password", "Value=liujf", ENDITEM,
                "Name=imageField.x", "Value=35", ENDITEM,
                "Name=imageField.y", "Value=0", ENDITEM,
                EXTRARES,
                "Url=images/dtree/base.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/plus.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/joinbottom.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/line.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/folder.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/join.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/page.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/empty.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/folderopen.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/plusbottom.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/dtree/minus.gif", "Referer=http://172.17.192.1:8080/test/frame/left.jsp", ENDITEM,
                "Url=images/table/tblbg.gif", "Referer=http://172.17.192.1:8080/test/jsp/Submit_record/Submit_recordAction!querySubmit_record_first.action", ENDITEM,
                "Url=components/calendar/datetime.js", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/plugins.js", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/datetime.css", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/arrowl.gif", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/arrowr.gif", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/plus.gif", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/minus.gif", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/bb.JPG", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                "Url=components/calendar/agenda.js?1330927440484", "Referer=http://172.17.192.1:8080/test/components/calendar/ipopeng.htm", ENDITEM,
                LAST);
if(atoi(lr_eval_string("{a_count}"))>0)
        lr_output_message("found");
else
lr_error_message("nofound");
        return 0;
}
这是一个登录系统,登录后页面会有显示文本“星期一”,但是为何我跑完脚本后,返回值是NOFOUND,count计数为0啊?
还有我选中UTF-8和没选中UTF-8都是一个样啊
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2012-3-6 11:36:58 | 只看该作者
今天是星期二了
回复 支持 反对

使用道具 举报

  • TA的每日心情

    2016-12-1 17:59
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    3#
    发表于 2012-3-7 11:51:01 | 只看该作者
    试试用英文做检查点。建议不要用汉字做检查
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2015-11-25 15:40
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    4#
    发表于 2012-3-8 10:17:58 | 只看该作者
    回复 1# ljfzqq


        从以下几个方面去调试:
        1、通过树视图看你的返回里有没有你要查找的关键字,且看他的位置在哪里
        2、查找一个肯定存在的字符串,看能不能找到,结果是否正确
        3、web_reg_find("Search=Body",
                             "SaveCount=a_count",
                             "Text=星期一",LAST);
         尝试修改为 Search=ALL
         4、检查最后的判断语句是否有错误,可以在3中的web_reg_find函数中添加 "Fail=NotFound"
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
    发表于 2012-3-8 12:32:15 | 只看该作者
    直接在tree模式下,自动添加,再试试
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6#
    发表于 2012-3-8 13:15:01 | 只看该作者
    2楼厉害
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7#
    发表于 2012-3-14 15:57:26 | 只看该作者
    我也碰到这个问题了。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    慵懒
    2015-3-26 08:59
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    8#
    发表于 2012-5-23 15:53:08 | 只看该作者
    回复 7# 蓝色水滴
    你咋解决的啊?
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-6-6 12:10 , Processed in 0.080194 second(s), 27 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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