51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4663|回复: 6
打印 上一主题 下一主题

[原创] LR如何处理页面的重定向问题??

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2011-8-10 10:27:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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次的重定向之后,才输出了页面内容(蓝色部分),地址(粉色部分)然后才开始重定向

这样耗费了很多的时间,是否有更优化的方法??
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2011-8-10 10:48:47 | 只看该作者
顶上去,顶上去
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2011-8-10 12:59:47 | 只看该作者
顶上去,顶上去
v522zy 发表于 2011-8-10 10:48



    ad
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2011-8-10 16:14:26 | 只看该作者
顶上去,顶上去
v522zy 发表于 2011-8-10 10:48



    ╮(╯▽╰)╭

顶顶
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2011-8-11 15:26:56 | 只看该作者
关注中,学习中
回复 支持 反对

使用道具 举报

该用户从未签到

6#
 楼主| 发表于 2011-8-11 17:16:36 | 只看该作者
顶上去,顶上去
v522zy 发表于 2011-8-10 10:48



    sd
回复 支持 反对

使用道具 举报

  • TA的每日心情
    慵懒
    2016-2-26 09:23
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    7#
    发表于 2016-4-19 17:45:01 | 只看该作者
    你中间少写了一个请求吧?

    评分

    参与人数 1测试积点 +10 收起 理由
    lsekfe + 10 积极回复获得测试积点10

    查看全部评分

    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-28 11:12 , Processed in 0.083725 second(s), 29 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表