LR-初学篇(检查点)

上一篇 / 下一篇  2012-12-13 13:29:35 / 个人分类:LR

LR检查点包含图片和文字两种形式
对于检查点有三种函数可以实现:其中是:web_find()、web_reg_find、web_image_check().
对于它们在使用的时候需设置以下,如在Vuser---run_time settings中勾选enable image and

test check
1)web_find()

   一种基于HTML模式的,一般是查找页面中的内容,所以应放在内容的后面,格式为:
   web_find("web_find","RighOf=a","LeftOf=b","What=name",LAST);
  有一个例子是LR帮助文档上的,拿来借鉴一下:
  例子是 searches for the text "Home" which is between "Go to" and "Page".
  web_url("index.html",
     "URL=http://server1/",
     "TargetFrame=",
    LAST );

  web_find("Text Check",
     "RightOf=Go to",
     "LeftOf=page",
     "What=Home",
     LAST );

2)web_reg_find()

   它是用来在缓存或代码中查找,放在内容之前,在录制过程中添加的检查点(只可以使用   

web_reg_find(),并且参数只有"Text=").
   格式是:web_reg_find("Search=Body","SaveCount=ddd","Test=aaa",LAST);
    同样例子如下:
    例子是用来:searches for the text string "Welcome". If the string is not found, it

fails and the script. execution stops.

  

   web_url("MercuryWebTours",

        "URL=http://localhost/MercuryWebTours/",

        "Resource=0",

        "RecContentType=text/html",

        "Referer=",

        "Snapshot=t1.inf",

        "Mode=HTML",

        LAST );

    Set up check for successful login by looking for "Welcome"

  ------  web_reg_find("Text=Welcome",

   -----     LAST );

Now log in

    web_submit_form("login.pl",

        "Snapshot=t2.inf",

        ITEMDATA,

        "Name=username", "Value=jojo", ENDITEM,

        "Name=password", "Value=bean", ENDITEM,

        "Name=login.x", "Value=35", ENDITEM,

        "Name=login.y", "Value=14", ENDITEM,

        LAST );

3)web_image_check()

   它是用来在页面中查找一个具体的图片,放在查找内容之前之后都可以
   格式是:web_image_check("Web_image_check","Alt=","Src=",LAST);
    其中Alt和Src都是源代码中相应参数值。
   这是根据在网上查看相关资料和自己亲手操作总结的,都是片面,给自己以后查看更加方便,也希望给需要的人微不足道的帮助吧。


TAG:

 

评分:0

我来说两句

Open Toolbar