whh1208 发表于 2017-11-15 16:59:51

请问LR录制的代码怎么删减

在网上了解到不能乱删减代码, 否则会不能模拟用户操作
我录了一个简单的登录功能,请受累解答一下

whh1208 发表于 2017-11-15 17:00:34

Action()
{

        web_reg_find("Text=您好",
                               "SaveCount=aj_count",
                               "Search=Body",
                LAST);

        lr_start_transaction("登录");

        web_url("login.htm",
                "URL=http://uc.cq.test:8571/login.htm",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/images/loginBg.png", ENDITEM,
                "Url=/images/logo.png", ENDITEM,
                LAST);


        web_submit_data("dologin.htm",
                "Action=http://uc.cq.test:8571/dologin.htm",
                "Method=POST",
                "RecContentType=text/html",
        //        "Referer=http://uc.cq.test:8571/login.htm",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
        //        "Name=backUrl", "Value=", ENDITEM,
        //        "Name=qualifyType", "Value=002001", ENDITEM,
        //        "Name=clientType", "Value=uc", ENDITEM,
        //        "Name=exchangeId", "Value=", ENDITEM,
                "Name=account", "Value=weihh1", ENDITEM,
        //        "Name=checkCode", "Value=", ENDITEM,
                "Name=password", "Value=q123456", ENDITEM,
        //        "Name=pdnames", "Value=,password", ENDITEM,
                EXTRARES,
                "Url=/images/icon2.png", "Referer=http://uc.cq.test:8571/index/default.htm?devMode=true&backUrl=", ENDITEM,
                "Url=/images/icon1.png", "Referer=http://uc.cq.test:8571/index/default.htm?devMode=true&backUrl=", ENDITEM,
                "Url=http://fw.cq.test:9085/scripts/My97DatePicker/skin/WdatePicker.css", "Referer=http://fw.cq.test:9085/accountLog/queryTodayAccountInfo.htm", ENDITEM,
                LAST);

/*
        web_custom_request("login_success_touch.json",
                "URL=http://uc.cq.test:8571/login_success_touch.json",
                "Method=POST",
                "Resource=0",
                "RecContentType=application/json",
                "Referer=http://uc.cq.test:8571/index/default.htm?devMode=true&backUrl=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                "EncType=",
                LAST);

        web_url("default.htm",
                "URL=http://uc.cq.test:8571/index/default.htm",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t4.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.base.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.theme.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.accordion.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.autocomplete.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.button.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.selectable.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.core.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.resizable.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.dialog.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.slider.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.tabs.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.datepicker.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                "Url=http://tradews.cq.test:8066/scripts/jquery-ui-1.8.21/themes/base/jquery.ui.progressbar.css", "Referer=http://tradews.cq.test:8066/auction/auctionNotice_iframeList.htm", ENDITEM,
                LAST);

        web_custom_request("login_success_touch.json_2",
                "URL=http://uc.cq.test:8571/login_success_touch.json",
                "Method=POST",
                "Resource=0",
                "RecContentType=application/json",
                "Referer=http://uc.cq.test:8571/index/default.htm",
                "Snapshot=t5.inf",
                "Mode=HTML",
                "EncType=",
                LAST);

        web_url("My97DatePicker.html",
                "URL=http://fw.cq.test:9085/scripts/My97DatePicker/My97DatePicker.html",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://fw.cq.test:9085/accountLog/queryTodayAccountInfo.htm",
                "Snapshot=t6.inf",
                "Mode=HTML",
                LAST);

        */


        if (atoi(lr_eval_string("{aj_count}"))== 1){
                lr_end_transaction("登录", LR_PASS);

                }
                else{
                        lr_end_transaction("登录", LR_FAIL);
                }

                lr_output_message("%d", web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE));

        return 0;
}

jingzizx 发表于 2017-11-15 20:20:44

看你的目的,是想测试下协议呢,还是完全模拟实际,如果想看协议返回
感觉web_url("default.htm", 可以进行删除

whh1208 发表于 2017-11-16 09:07:53

jingzizx 发表于 2017-11-15 20:20
看你的目的,是想测试下协议呢,还是完全模拟实际,如果想看协议返回
感觉web_url("default.htm", 可以进 ...

谢谢,我是想模拟一下用户登录
目前的想法是只保留第一个url二第二个表单提交
页: [1]
查看完整版本: 请问LR录制的代码怎么删减