和录制脚本不一样的是,lr支持手写请求,利用函数手写,也很方便
步骤
design--insertscript 我常用的web_custom_request函数
分别添加这个请求的名字
方式
完整地址
targetframe没填写过
body写请求体,注意要对双引号利用\转义,中间空格删除
录制模式 http
源代码:二进制勾选
encoding type:编码类型
源代码附上
注释部分是录制的请求,其他手写的请求
处于隐私 部分地址删除
Action()
{
/*web_custom_request("userLogin",
"URL=http://青帮地址",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/plain",
"Referer=",
"Snapshot=t27.inf",
"Mode=HTTP",
"EncType=application/json",
"Body={\"phone\":\"1558\",\"passWord\":\"123456\"}",
LAST);
web_custom_request("/app/login",
"URL=http://农场地址/app/login",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/plain",
"Referer=",
"Snapshot=t27.inf",
"Mode=HTTP",
"EncType=application/json",
"Body={\"phone\":\"1558\",\"password\":\"123456\"}",
LAST);
web_custom_request("/app/phoneLogin",
"URL=http://蜜獾地址/app/phoneLogin",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/plain",
"Referer=",
"Snapshot=t27.inf",
"Mode=HTTP",
"EncType=application/json",
"Body={\"telephone\":\"1558\",\"type\":\"1\",\"pwd\":\"123456\",\"phoneType\":\"1\",\"token\":\"c7b5a3163509b0374ac0057a386a6baf\"}",
LAST);*/
web_custom_request("web_custom_request",
"URL=http://青帮/app/userLogin",
"Method=post",
"TargetFrame=",
"Resource=0",
"RecContentType=text/plain",
"EncType=application/json",
"Referer=",
"Mode=HTTP",
"BodyBinary={\"phone\":\"155\",\"passWord\":\"123456\"}",
LAST);
web_custom_request("shouxie",
"URL=http://青帮/app/userLogin",
"Method=post",
"TargetFrame=",
"Resource=1",
"Referer=",
"Mode=HTTP",
"EncType=application/json",
"BodyBinary={\"phone\":\"1558\",\"passWord\":\"123456\"}",
LAST);
return 0;
}