|
本帖最后由 v522zy 于 2011-8-11 17:19 编辑
代码如下:
- do{
- // 重定向目标地址
- web_reg_save_param("DEST",
- "LB=getPosition\">",
- "RB=</a>",
- "Ord=1",
- "NotFound=Warning",
- "Search=body",
- LAST );
- web_reg_save_param("REST",
- "LB=",
- "RB=",
- "Search=body",
- LAST);
- rfind = web_reg_find("Text=ABCDEFG",
- LAST );
- web_custom_request("LOCATE",
- "URL={DEST}",
- "Method=GET",
- "Resource=0",
- "Mode=HTML",
- "Body=",
- LAST);
- lr_convert_string_encoding( lr_eval_string("{REST}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE, "str1" );
- lr_output_message(lr_eval_string("{str1}"));
- lr_output_message(lr_eval_string("REDIRECTING TO :{DEST}"));
- //HTTP返回码
- HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
- lr_output_message("HTTP RETURN CODE = %d,,result of find = %d", HttpRetCode, rfind);
- } while ((HttpRetCode>=300) & (HttpRetCode<400)); //301,302
复制代码
以下为回放的记录
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=2&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=2&actionType=getPosition" (redirection depth is 1)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=3&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=3&actionType=getPosition" (redirection depth is 2)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=4&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=4&actionType=getPosition" (redirection depth is 3)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=5&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=5&actionType=getPosition" (redirection depth is 4)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=6&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=6&actionType=getPosition" (redirection depth is 5)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=7&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=7&actionType=getPosition" (redirection depth is 6)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=8&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=8&actionType=getPosition" (redirection depth is 7)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=9&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=9&actionType=getPosition" (redirection depth is 8)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=10&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=10&actionType=getPosition" (redirection depth is 9)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=11&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=11&actionType=getPosition" (redirection depth is 10)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=12&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=12&actionType=getPosition" (redirection depth is 11)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=13&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=13&actionType=getPosition" (redirection depth is 12)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=14&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=14&actionType=getPosition" (redirection depth is 13)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=15&actionType=getPosition"
Action.c(173): Redirecting "http://SERVERAUT/wap/servlet/locateservlet?times=15&actionType=getPosition" (redirection depth is 14)
Action.c(173): To location "http://SERVERAUT/wap/servlet/locateservlet?times=16&actionType=getPosition"
Action.c(173): Found resource "http://SERVERAUT/wap/images/wap.css" in HTML "http://SERVERAUT/wap/servlet/locateservlet?times=16&actionType=getPosition"
Action.c(173): Continuing after Error -26366: "Text=getMap" not found for web_reg_find
Action.c(173): web_custom_request("LOCATE") highest severity level was "continue on error", 7692 body bytes, 4470 header bytes, 180 chunking overhead bytes
Action.c(173): Continuing after error in Vuser script.
Action.c(185): bgcolor="#FFFFFF">
<p>This document you requested has moved temporarily.</p>
<p>It's now at <a href="http://SERVERAUT/wap/servlet/locateservlet?times=2&actionType=getPosition">http://SERVERAUT/wap/servlet/locateservlet?times=2&actionType=getPosition</a>.</p>
REDIRECTING TO :http://SERVERAUT/wap/servlet/locateservlet?times=2&actionType=getPosition
Action.c(189): web_get_int_property was successful
Action.c(191): HTTP RETURN CODE = 200,,result of find = 0
该脚本无法录制,全手写
进入http://SERVERAUT/wap/servlet/locateservlet?actionType=locate&tuId=ABCDE(以下称为页面ABCDE)页面时,开始重定向,
我已经使用do-while把重定向的地址保存了并且请求完页后开始定向到目标页面,如此往复
但貌似访问ABCDE页面时,就打出如上的日志,
在16次的重定向之后,才输出了页面内容(蓝色部分),地址(粉色部分)然后才开始重定向
这样耗费了很多的时间,是否有更优化的方法?? |
|