我们先看看脚本吧
web_reg_find(
"Text=南大通用",
"SaveCount=Find_Count",
"Fail=NotFound",
LAST);
web_url("search",
"URL=http://www.google.cn/search?hl=zh-CN&q=gbase&btnG=Google+%E6%90%9C%E7%B4%A2&meta=&aq=f&oq=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.google.cn/",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"Url=/extern_js/f/CgV6aC1DThICY24rMAo4C0ACLCswGDgDLA/N9TKf6zywrI.js", "Referer=http://www.google.cn/search?hl=zh-CN&q=gbase&btnG=Google+%E6%90%9C%E7%B4%A2&meta=&aq=f&oq=", ENDITEM,
LAST);
if (atoi(lr_eval_string("{Find_Count}")) > 0){
lr_output_message("搜索成功.");
}else{
lr_error_message("搜索失败,没有找到需要的数据!");
return(0);
}
注意:
web_reg_find 要在要查找的页面前面进行,也就是在后面的页面里查找数据
具体的一些参数如下,都采用 Name=Value的格式指定
Text:
The text string to search for. Text is a non-empty, null-terminated character string. You can further customize your search by using text flags. You must specify the following two attributes if you do not specify Text. You can further customize your search by using text flags with these attributes.
要查找的文本,不能为空。如果不指定,则必须使用后面的2个参数指示要搜索的文本
TextPfx:
The text immediately preceding the text string for which you are searching.
要搜索的内容前面必须有的内容
TextSfx:
The text immediately following the text string for which you are searching.
要搜索的内容后面必须有的内容
Search:
The scope of the search-where to search for the string. The possible values are Headers (search only the headers), Body (search only the Body data), Noresource (search only the HTML body, excluding headers and resources), or ALL (search body , headers, and resources). The default value is BODY.
搜索的范围,可以是Headers(也就是请求头部分),Body(主体数据),Noresource(只走所HTML的主题,不包括头和资源),或者All(搜索主体,头和资源),默认是 BODY
SaveCount:
The number of matches that were found.
搜索找到的匹配次数
Fail:
The handling method that sets the condition under which the check fails.
如果同时使用了SaveCount和Fail=NotFound,则如果没有找到匹配的,将引起事务失败。
ID:
An identifying string that associates the entry in the log file with the call to web_reg_find. See the example.
将在日志里面用这个唯一标识,可以更容易的找到我们要找的日志输出
RelFrameId:
The relative frame ID, for example: 1.2
Note: RelFrameID is not supported in GUI level scripts.
相对的框架ID