lr 的 web_image_check的用法
首先:不要相信帮助 ,帮助写的太模糊.有些东西要自己试过才知道.
在网页中 ,有个 web_image_check 的函数.是检查图片的.
如果存在制定的图片,系统就认为成功.(这个函数成功,否者 这个函数失败,也会导致函数所处的事务失败)
下面是 帮助的解释:
In the following example, the web_image_check function looks for the image ALT text is "Venus" in the ImagesAndMaps page:
web_url("index.html", "URL=http://localhost/ImagesAndMaps.html",
"TargetFrame=", LAST);
web_image_check("Go2Venus", "Alt=Venus", LAST);
上面是函数举的例子.
起始 ALT和SRC是忽略大小写的 .而且 要写全路径.否则就会报错.
下面是我的脚本:
web_image_check("forone","src=../images/home.gif",LAST);
如果写成web_image_check("forone","src=home",LAST);
web_image_check("forone","src=/home.gif",LAST);
只写图片的名称,或者写不全路径
调试就会出错.
Action.c(13): web_url("ListMBeansAction_4") was successful, 18639 body bytes, 545 header bytes, 56 chunking overhead bytes
Action.c(23): Error -27191: "forone" failed (0 occurrence(s) found. Alt="", Src="../images/home.gif")
Action.c(23): web_image_check highest severity level was "ERROR"
Ending action Action.
所以 .要写全 HTML 的 路路径
web_image_check("forone","src=http://192.168.0.135:7001/console/images/home.gif",LAST);
才会成功
ction.c(23): "forone" succeeded (1 occurrence(s) found. Alt="", Src="http://192.168.0.135:7001/console/images/home.gif")
Action.c(23): web_image_check was successful
强烈建议LR 把帮助写的更细致..没有中文的资料.只能靠这点英文帮助了.
我用的是盗版,我是替那些正版用户 鸣不平..~~~~
@_# 哦~谢谢分享 我有一个脚本,我输入了图片的完整路径,可是居然还是找不到啊,不知道为什么。等下次我把脚本贴上来看看。 哦~谢谢分享 web_image("Itinerary Button",
"Alt=Itinerary Button",
"Snapshot=t8.inf",
LAST);
web_image_check("search_cancel_image",
"Src=cancelreservation.gif",
LAST);
web_image_check("web_image_check",
"Src=hp_logo.png",
LAST);
lr_think_time(4);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t9.inf",
LAST);
lr_output_message("****Flight reserved successfully.****");
return 0;
上面是部分脚本。对于cancelreservation.gif这个图片我始终找不到。换成了全路径也找不到。但是下面的hp_logo.png这个图片能够成功检查到。
下面是Replay Log中的相关部分。
Action.c(98): Found resource "http://127.0.0.1:1080/WebTours/images/cancelreservation.gif" in HTML "http://127.0.0.1:1080/WebTours/itinerary.pl"
Action.c(98): Found resource "http://127.0.0.1:1080/WebTours/images/cancelallreservations.gif" in HTML "http://127.0.0.1:1080/WebTours/itinerary.pl"
Action.c(98): web_image("Itinerary Button") was successful, 28671 body bytes, 1174 header bytes
Action.c(103): Continuing after Error -27191: "search_cancel_image" failed (0 occurrence(s) found. Alt="", Src="cancelreservation.gif")
Action.c(103): web_image_check highest severity level was "continue on error"
楼主帮我看看有什么问题没? 我自己始终是看不明白。 :call: :call: :call: :call:
页:
[1]