51Testing软件测试论坛

标题: LR如何处理页面的重定向问题?? [打印本页]

作者: v522zy    时间: 2011-8-10 10:27
标题: LR如何处理页面的重定向问题??
本帖最后由 v522zy 于 2011-8-11 17:19 编辑

代码如下:
  1. do{
  2.         // 重定向目标地址
  3.         web_reg_save_param("DEST",
  4.                  "LB=getPosition\">",
  5.                 "RB=</a>",
  6.                  "Ord=1",
  7.                  "NotFound=Warning",
  8.                  "Search=body",
  9.                  LAST );

  10.         web_reg_save_param("REST",
  11.                 "LB=",
  12.                 "RB=",
  13.                 "Search=body",
  14.                 LAST);

  15.         rfind = web_reg_find("Text=ABCDEFG",
  16.                 LAST );

  17.         web_custom_request("LOCATE",
  18.                 "URL={DEST}",
  19.                 "Method=GET",
  20.         "Resource=0",
  21.                 "Mode=HTML",
  22.                 "Body=",
  23.                 LAST);

  24.         lr_convert_string_encoding( lr_eval_string("{REST}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,  "str1" );
  25.         lr_output_message(lr_eval_string("{str1}"));

  26.         lr_output_message(lr_eval_string("REDIRECTING TO :{DEST}"));

  27.     //HTTP返回码
  28.         HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

  29.         lr_output_message("HTTP RETURN CODE = %d,,result of find = %d", HttpRetCode, rfind);

  30.         } 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次的重定向之后,才输出了页面内容(蓝色部分),地址(粉色部分)然后才开始重定向

这样耗费了很多的时间,是否有更优化的方法??
作者: v522zy    时间: 2011-8-10 10:48
顶上去,顶上去
作者: v522zy    时间: 2011-8-10 12:59
顶上去,顶上去
v522zy 发表于 2011-8-10 10:48



    ad
作者: v522zy    时间: 2011-8-10 16:14
顶上去,顶上去
v522zy 发表于 2011-8-10 10:48



    ╮(╯▽╰)╭

顶顶
作者: zhang.yuandong    时间: 2011-8-11 15:26
关注中,学习中
作者: v522zy    时间: 2011-8-11 17:16
顶上去,顶上去
v522zy 发表于 2011-8-10 10:48



    sd
作者: sheldontest    时间: 2016-4-19 17:45
你中间少写了一个请求吧?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2