51Testing软件测试论坛

标题: LR重定向问题,新手求助 [打印本页]

作者: yzqwqp    时间: 2015-8-29 20:39
标题: LR重定向问题,新手求助
一个登陆的脚本(如下),登陆时需要走cas服务器验证,经过排查访问web_submit_data("login_loginIn.action"),这个方法的时候会进行重定向操作(如图)
对于重定向操作已百度,但搞了半天没弄好,新手小白,请教各位大神帮助。感激不尽~~
Action()
{
web_reg_save_param_ex(
        "ParamName=sessionid",
        "LB=JSESSIONID=",
        "RB=,",
        SEARCH_FILTERS,
        LAST);

    web_url("index.action",
        "URL=http://192.168.17.196:8080/portal/login/index.action",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t1.inf",
        "Mode=HTML",
        EXTRARES,
        "Url=../images/index_icon.png", ENDITEM,
        "Url=../images/btnBg.png", ENDITEM,
        LAST);

    lr_start_transaction("登录门户");

web_submit_data("login_loginIn.action",
        "Action=http://192.168.17.196:8080/portal/login/login_loginIn.action",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/html",
        "Referer=http://192.168.17.196:8080/portal/login/index.action",
        "Snapshot=t2.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=username", "Value=123234", ENDITEM,
        "Name=password", "Value=qqqqqq", ENDITEM,
        "Name=cookie", "Value=JSESSIONID={sessionid}; Path=/cas", ENDITEM,
        "Name=casaction", "Value=/cas/login;jsessionid={sessionid}", ENDITEM,
        "Name=ltname", "Value=_cE40E9E73-70AD-D8AE-75C4-F21055722E26_k19D3BCD7-D5C7-FF82-2B76-CCBA3576D924", ENDITEM,
        "Name=service", "Value=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        EXTRARES,
        "Url=../images/web_bottom_bj.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/web_top_bj.jpg", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/web_main_bj.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/content_title_bj.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/task/tips.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/search_btn.gif", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/adv/serivce_adv.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/ico.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/bg_windows03.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/bg_windows02.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/two_dimension.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        "Url=../images/close1.png", "Referer=http://192.168.17.196:8080/portal/main/index.action", ENDITEM,
        LAST);

    web_custom_request("task_taskInfo.action",
        "URL=http://192.168.17.196:8080/portal/main/task_taskInfo.action",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://192.168.17.196:8080/portal/main/index.action",
        "Snapshot=t3.inf",
        "Mode=HTML",
        "EncType=",
        EXTRARES,
        "Url=../images/win_shadow.png", "Referer=http://192.168.17.196:8080/portal/addressBook/org_index.action", ENDITEM,
        "Url=../images/record_table_th.gif", "Referer=http://192.168.17.196:8080/portal/addressBook/org_index.action", ENDITEM,
        "Url=/favicon.ico", "Referer=", ENDITEM,
        LAST);

    web_submit_data("calendar_getSelectCalendar.action",
        "Action=http://192.168.17.196:8080/portal/main/calendar_getSelectCalendar.action",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/html",
        "Referer=http://192.168.17.196:8080/portal/main/calendar_toShow.action",
        "Snapshot=t4.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=vdate", "Value=2015-8", ENDITEM,
        LAST);

    web_submit_data("topTree_getTree.action",
        "Action=http://192.168.17.196:8080/portal/addressBook/topTree_getTree.action",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/json",
        "Referer=http://192.168.17.196:8080/portal/addressBook/topTree_index.action",
        "Snapshot=t5.inf",
        "Mode=HTML",
        ITEMDATA,
        LAST);

    web_custom_request("quickMenu_queryQuickMenuByAjax.action",
        "URL=http://192.168.17.196:8080/portal/main/quickMenu_queryQuickMenuByAjax.action",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/json",
        "Referer=http://192.168.17.196:8080/portal/main/shortCut_showLeftMenu.action",
        "Snapshot=t6.inf",
        "Mode=HTML",
        "EncType=",
        LAST);

    lr_end_transaction("登录门户",LR_AUTO);

    return 0;
}



作者: jingzizx    时间: 2015-8-31 14:09
如果是重定向的话,在函数web_submit_data中直接使用目标网址应该可以




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