51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3455|回复: 13
打印 上一主题 下一主题

[原创] 文本检查点的疑问

[复制链接]
  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    跳转到指定楼层
    1#
    发表于 2007-12-14 11:09:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    在脚本视图,给页面添加“文本检查点”时有两种方法,如图示(A)、(B)。

    今天用WebTours尝试如下操作:
    1、创建了100个用户,用户名为test001、test002……test100,密码同用户名一样;
    2、录制一个 登录、退出的脚本;
    3、参数化用户名和密码;
    4、设计登录退出100个循环,用户随机选择;
    5、添加图像检查点和文本检查点。

    图像检查点用SRC,Check很容易通过。文本检查点有两种方式,容易报错,贴出来请高手指点千秋。此页面的HTML代码如下:
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
    <head><title>Welcome to Mercury Tours</title></head>
    <body bgcolor="#E0E7F1">
    <img src=/MercuryWebTours/images/fma-performance-center.jpg><p />
    <style>blockquote {font-family: tahoma; font-size : 10pt}H1 {font-family: tahoma; font-size : 22pt; color: #993333}small {font-family: tahoma; font-size : 8pt}H3 {font-family: tahoma; font-size : 10pt; color: black}TD {font-family: tahoma; font-size : 10pt; color: black}</style>
    <blockquote>Welcome, <b>jojo</b>, to the Mercury Tours reservation pages.<BR>Using the menu to the left, you can search for new flights to book, or review/edit the flights already booked.  Don't forget to sign off whenyou're done!</blockquote>
    </body></html>

    登录后,文本检查:显示登录的用户名(test001、test002....test100),老是出错(找不到指定数据)。

    如果设置为查找test,就都可以成功,不知哪个环节出错了?

    登录的用户名是"test{Num}"参数化的常量+参数,{Num}是随机从001~100的抽取的。

    [ 本帖最后由 higkoo 于 2007-12-14 11:11 编辑 ]

    本帖子中包含更多资源

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

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
     楼主| 发表于 2007-12-14 11:17:46 | 只看该作者

    web_reg_find

    使用B操作        
    web_reg_find("Search=Body",
            "Text={Num}",
            LAST);
    即查找登录用户的test的后缀,验证失败,附图:

    本帖子中包含更多资源

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

    x
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    3#
     楼主| 发表于 2007-12-14 11:22:20 | 只看该作者

    web_find

    使用操作(A)也失败,附图:

    另外,图上的左边界和右边界,是指界面上的体现还是HTML源码的左右边界?

    本帖子中包含更多资源

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

    x
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
    发表于 2007-12-14 11:46:55 | 只看该作者
    1.在login.c中增加检查代码测试一下
    2.更换检查点进行测试
    Login()
    {

            lr_save_string( lr_eval_string("test{Num}"),
                    "Words" );

            lr_start_transaction("登录系统");

            web_reg_find("Text=test",
                    "SaveCount=count",
                    LAST);
            web_submit_data("login.pl",
                    "Action=http://test3:2000/mercurywebtours/login.pl",
                    "Method=POST",
                    "RecContentType=text/html",
                    "Referer=http://test3:2000/mercurywebtours/nav.pl?in=home",
                    "Snapshot=t2.inf",
                    "Mode=HTML",
                    ITEMDATA,
                    "Name=userSession", "Value={WCSParam_Diff1}", ENDITEM,
                    "Name=username", "Value={Words}", ENDITEM,
                    "Name=password", "Value={Words}", ENDITEM,
                    "Name=JSFormSubmit", "Value=off", ENDITEM,
                    "Name=login.x", "Value=0", ENDITEM,
                    "Name=login.y", "Value=0", ENDITEM,
                    LAST);
                    if (atoi(lr_eval_string("{count}")) > 0){
               lr_output_message("----%被成功检查!",lr_eval_string("{Num}"));
           }

       else{
               lr_error_message("----%s不能被检查到",lr_eval_string("{Num}"));
               return(0);
           }
            web_find("web_find",
                    "What=test",
                    LAST);

            lr_end_transaction("登录系统", LR_AUTO);

            return 0;
    }
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    5#
     楼主| 发表于 2007-12-14 11:58:36 | 只看该作者

    回复 4# swordtong 的帖子

    楼上 swordtong 的脚本是可以正常运行的,
    你的脚本是查找的test,然后输出{Num}。

    能否这样? :
    假设登录用户为test088,查找的就是test088而不是只查找test。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6#
    发表于 2007-12-14 12:20:15 | 只看该作者
    我想楼主对这个检查点的理解不大对。

    你搜索的是{Num},而在运行中已经被参数替换了。所以应该是搜索不成功的。

    我觉得你在楼上说的方式可行。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    7#
     楼主| 发表于 2007-12-14 12:53:01 | 只看该作者

    回复 6# Zee 的帖子

    登录用户为test088,查找的就是test088

    登录用户是动态(参数化)的。   检查点要与之对应才行,如何实现?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    8#
    发表于 2007-12-14 13:04:47 | 只看该作者

    同问!

    同问!
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    9#
    发表于 2007-12-14 13:16:40 | 只看该作者
    这个检查点可以这么设置:
    脚本如下:
    Action()
    {


            web_url("WebTours",
                    "URL=http://127.0.0.1:1080/WebTours/",
                    "Resource=0",
                    "RecContentType=text/html",
                    "Referer=",
                    "Snapshot=t1.inf",
                    "Mode=HTML",
                    LAST);
            lr_think_time(6);

            web_reg_find("Text={name}",
                    "Search=Body",
                    LAST);
            web_submit_form("login.pl",
                    "Snapshot=t2.inf",
                    ITEMDATA,
                    "Name=username", "Value={name}", ENDITEM,
                    "Name=password", "Value={password}", ENDITEM,
                    "Name=login.x", "Value=27", ENDITEM,
                    "Name=login.y", "Value=3", ENDITEM,
                    LAST);

            web_image("SignOff Button",
                    "Alt=SignOff Button",
                    "Snapshot=t3.inf",
                    LAST);

            return 0;
    }


    结果如下:
    Virtual User Script started
    Starting action vuser_init.
    Web Turbo Replay of LoadRunner 9.0.0 for WIN2003; WebReplay82 build 5727          [MsgId: MMSG-27143]
    Run-Time Settings file: "C:\Documents and Settings\Administrator\Local Settings\Temp\noname7\\default.cfg"          [MsgId: MMSG-27141]
    Ending action vuser_init.
    Running Vuser...
    Starting iteration 1.
    Starting action Action.
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/header.html" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/hp_logo.png" in HTML "http://127.0.0.1:1080/WebTours/header.html"          [MsgId: MMSG-26659]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/webtours.png" in HTML "http://127.0.0.1:1080/WebTours/header.html"          [MsgId: MMSG-26659]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"          [MsgId: MMSG-26574]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"          [MsgId: MMSG-26574]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?in=home"          [MsgId: MMSG-26659]
    Action.c(5): web_url("WebTours") was successful, 6472 body bytes, 1562 header bytes          [MsgId: MMSG-26386]
    Action.c(15): Notify: Parameter Substitution: parameter "name" =  "jojo"
    Action.c(15): Registering web_reg_find was successful          [MsgId: MMSG-26390]
    Action.c(18): Notify: Parameter Substitution: parameter "name" =  "jojo"
    Action.c(18): Notify: Next row for parameter password = 1 [table  = password].
    Action.c(18): Notify: Parameter Substitution: parameter "password" =  "bean"
    Action.c(18): Submitting form to "http://127.0.0.1:1080/WebTours/login.pl", Target Frame="body"          [MsgId: MMSG-27978]
    Action.c(18): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home" in "http://127.0.0.1:1080/WebTours/login.pl"          [MsgId: MMSG-26574]
    Action.c(18): Detected non-resource "http://127.0.0.1:1080/WebTours/login.pl?intro=true" in "http://127.0.0.1:1080/WebTours/login.pl"          [MsgId: MMSG-26574]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/flights.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/itinerary.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/in_home.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/signoff.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Registered web_reg_find successful for "Text=jojo" (count=1)          [MsgId: MMSG-26364]
    Action.c(18): web_submit_form("login.pl") was successful, 5617 body bytes, 1538 header bytes          [MsgId: MMSG-26386]
    Action.c(27): Image-linking to "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1", Target Frame="body"          [MsgId: MMSG-27993]
    Action.c(27): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
    Action.c(27): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
    Action.c(27): Retrieving data from cache for "http://127.0.0.1:1080/WebTours/home.html"          [MsgId: MMSG-26558]
    Action.c(27): Resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" is in the cache already and will not be downloaded again          [MsgId: MMSG-26655]
    Action.c(27): web_image("SignOff Button") was successful, 1974 body bytes, 577 header bytes          [MsgId: MMSG-26386]
    Ending action Action.
    Ending iteration 1.
    Starting iteration 2.
    Notify: Next row for parameter name = 2 [table  = name].
    Notify: Getting new value for parameter 'name': table = 'name.dat' column = '0' row = '2'.
    Notify: Next row for parameter password = 2 [table  = password].
    Notify: Getting new value for parameter 'password': table = 'password.dat' column = '0' row = '2'.
    Starting action Action.
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/header.html" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/hp_logo.png" in HTML "http://127.0.0.1:1080/WebTours/header.html"          [MsgId: MMSG-26659]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/webtours.png" in HTML "http://127.0.0.1:1080/WebTours/header.html"          [MsgId: MMSG-26659]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"          [MsgId: MMSG-26574]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"          [MsgId: MMSG-26574]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?in=home"          [MsgId: MMSG-26659]
    Action.c(5): web_url("WebTours") was successful, 6472 body bytes, 1562 header bytes          [MsgId: MMSG-26386]
    Action.c(15): Notify: Parameter Substitution: parameter "name" =  "test1"
    Action.c(15): Registering web_reg_find was successful          [MsgId: MMSG-26390]
    Action.c(18): Notify: Parameter Substitution: parameter "name" =  "test1"
    Action.c(18): Notify: Next row for parameter password = 2 [table  = password].
    Action.c(18): Notify: Parameter Substitution: parameter "password" =  "test1"
    Action.c(18): Submitting form to "http://127.0.0.1:1080/WebTours/login.pl", Target Frame="body"          [MsgId: MMSG-27978]
    Action.c(18): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home" in "http://127.0.0.1:1080/WebTours/login.pl"          [MsgId: MMSG-26574]
    Action.c(18): Detected non-resource "http://127.0.0.1:1080/WebTours/login.pl?intro=true" in "http://127.0.0.1:1080/WebTours/login.pl"          [MsgId: MMSG-26574]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/flights.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/itinerary.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/in_home.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/signoff.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Registered web_reg_find successful for "Text=test1" (count=1)          [MsgId: MMSG-26364]
    Action.c(18): web_submit_form("login.pl") was successful, 5618 body bytes, 1482 header bytes          [MsgId: MMSG-26386]
    Action.c(27): Image-linking to "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1", Target Frame="body"          [MsgId: MMSG-27993]
    Action.c(27): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
    Action.c(27): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
    Action.c(27): Retrieving data from cache for "http://127.0.0.1:1080/WebTours/home.html"          [MsgId: MMSG-26558]
    Action.c(27): Resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" is in the cache already and will not be downloaded again          [MsgId: MMSG-26655]
    Action.c(27): web_image("SignOff Button") was successful, 1982 body bytes, 577 header bytes          [MsgId: MMSG-26386]
    Ending action Action.
    Ending iteration 2.
    Starting iteration 3.
    Notify: Next row for parameter name = 3 [table  = name].
    Notify: Getting new value for parameter 'name': table = 'name.dat' column = '0' row = '3'.
    Notify: Next row for parameter password = 3 [table  = password].
    Notify: Getting new value for parameter 'password': table = 'password.dat' column = '0' row = '3'.
    Starting action Action.
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/header.html" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/hp_logo.png" in HTML "http://127.0.0.1:1080/WebTours/header.html"          [MsgId: MMSG-26659]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/webtours.png" in HTML "http://127.0.0.1:1080/WebTours/header.html"          [MsgId: MMSG-26659]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"          [MsgId: MMSG-26574]
    Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true"          [MsgId: MMSG-26574]
    Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?in=home"          [MsgId: MMSG-26659]
    Action.c(5): web_url("WebTours") was successful, 6468 body bytes, 1562 header bytes          [MsgId: MMSG-26386]
    Action.c(15): Notify: Parameter Substitution: parameter "name" =  "test2"
    Action.c(15): Registering web_reg_find was successful          [MsgId: MMSG-26390]
    Action.c(18): Notify: Parameter Substitution: parameter "name" =  "test2"
    Action.c(18): Notify: Next row for parameter password = 3 [table  = password].
    Action.c(18): Notify: Parameter Substitution: parameter "password" =  "test2"
    Action.c(18): Submitting form to "http://127.0.0.1:1080/WebTours/login.pl", Target Frame="body"          [MsgId: MMSG-27978]
    Action.c(18): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home" in "http://127.0.0.1:1080/WebTours/login.pl"          [MsgId: MMSG-26574]
    Action.c(18): Detected non-resource "http://127.0.0.1:1080/WebTours/login.pl?intro=true" in "http://127.0.0.1:1080/WebTours/login.pl"          [MsgId: MMSG-26574]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/flights.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/itinerary.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/in_home.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Found resource "http://127.0.0.1:1080/WebTours/images/signoff.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home"          [MsgId: MMSG-26659]
    Action.c(18): Registered web_reg_find successful for "Text=test2" (count=1)          [MsgId: MMSG-26364]
    Action.c(18): web_submit_form("login.pl") was successful, 5618 body bytes, 1482 header bytes          [MsgId: MMSG-26386]
    Action.c(27): Image-linking to "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1", Target Frame="body"          [MsgId: MMSG-27993]
    Action.c(27): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
    Action.c(27): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
    Action.c(27): Retrieving data from cache for "http://127.0.0.1:1080/WebTours/home.html"          [MsgId: MMSG-26558]
    Action.c(27): Resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" is in the cache already and will not be downloaded again          [MsgId: MMSG-26655]
    Action.c(27): web_image("SignOff Button") was successful, 1986 body bytes, 577 header bytes          [MsgId: MMSG-26386]
    Ending action Action.
    Ending iteration 3.
    Ending Vuser...
    Starting action vuser_end.
    Ending action vuser_end.
    Vuser Terminated.
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    10#
     楼主| 发表于 2007-12-14 13:50:43 | 只看该作者

    问题已解决

    运行成功:
    1.        
    2. lr_save_string( lr_eval_string("test{Num}"),"Words" );

    3.         web_reg_find("Text={Words}", "Search=Body",LAST);  //就是这句的问题

    4.         web_submit_data("login.pl",
    5.                 "Action=http://test3:2000/mercurywebtours/login.pl",
    6.                 "Method=POST","RecContentType=text/html",
    7.                 "Referer=http://test3:2000/mercurywebtours/nav.pl?in=home",
    8.                 "Snapshot=t2.inf","Mode=HTML",ITEMDATA,
    9.                 "Name=userSession", "Value={WCSParam_Diff1}", ENDITEM,
    10.                 "Name=username", "Value={Words}", ENDITEM,
    11.                 "Name=password", "Value={Words}", ENDITEM,
    12.                 "Name=JSFormSubmit", "Value=off", ENDITEM,
    13.                 "Name=login.x", "Value=0", ENDITEM,
    14.                 "Name=login.y", "Value=0", ENDITEM,LAST);
    复制代码


    运行失败:
    1.        

    2. lr_save_string( lr_eval_string("test{Num}"),"Words" );

    3.         web_reg_find("Text=test{Num}", "Search=Body",LAST); //就是这句的问题

    4.         web_submit_data("login.pl",
    5.                 "Action=http://test3:2000/mercurywebtours/login.pl",
    6.                 "Method=POST","RecContentType=text/html",
    7.                 "Referer=http://test3:2000/mercurywebtours/nav.pl?in=home",
    8.                 "Snapshot=t2.inf","Mode=HTML",ITEMDATA,
    9.                 "Name=userSession", "Value={WCSParam_Diff1}", ENDITEM,
    10.                 "Name=username", "Value={Words}", ENDITEM,
    11.                 "Name=password", "Value={Words}", ENDITEM,
    12.                 "Name=JSFormSubmit", "Value=off", ENDITEM,
    13.                 "Name=login.x", "Value=0", ENDITEM,
    14.                 "Name=login.y", "Value=0", ENDITEM,LAST);
    复制代码
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    11#
    发表于 2007-12-14 13:53:44 | 只看该作者
    呵呵,你把一个参数,保存到另一个参数里,然后再检查,和你直接用那个参数检查有什么区别?

    你这样不是多了一道手续吗?
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    12#
     楼主| 发表于 2007-12-14 14:05:42 | 只看该作者

    回复 10# Zee 的帖子

    你这样不是多了一道手续吗?

    是多余了

    相当手动实现了将{Num} Each occurrence  变为 了Each iteration。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    13#
    发表于 2007-12-14 14:15:22 | 只看该作者
    终于忙完了来看看,lz的方法明显的绕弯了:p
    zee在9楼的代码很清晰,这个方法已经很优化了。
    还有顺便说一句现在一般很少用web_find这个方法了。当时有一篇帖子说过2种方法的优劣之处,具体记得不是很清楚了,最后还是推荐使用web_reg_find,有时间的话可以找找看看具体原因。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2014-12-26 13:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    14#
     楼主| 发表于 2007-12-15 13:08:43 | 只看该作者

    问题原因

    把lr_save_string转换的那句给删掉之后,再用以前的脚本,全部都是正常的了:

           web_reg_find("Text=test{Num}",
                    "Search=Body",
                    LAST);

            web_submit_data("login.pl",
                    "Action=http://test3:2000/mercurywebtours/login.pl",
                    "Method=POST",
                    "RecContentType=text/html",
                    "Referer=http://test3:2000/mercurywebtours/nav.pl?in=home",
                    "Snapshot=t2.inf",
                    "Mode=HTML",
                    ITEMDATA,
                    "Name=userSession", "Value={WCSParam_Diff1}", ENDITEM,
                    "Name=username", "Value=test{Num}", ENDITEM,
                    "Name=password", "Value=test{Num}", ENDITEM,
                    "Name=JSFormSubmit", "Value=off", ENDITEM,
                    "Name=login.x", "Value=0", ENDITEM,
                    "Name=login.y", "Value=0", ENDITEM,
                    LAST);
    直接这样运行也是成功的。

      可能是用lr_save_string后 前后两者有什么差异或其它未知内部原因导致的错误吧。

    从用户脚本来看就不用管这个问题了,不过理论上来说应该是某个地方还存在有问题。
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-9-25 12:19 , Processed in 0.110355 second(s), 29 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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