lr12关联,响应乱码

2021年09月15日 阅读数:1
这篇文章主要向大家介绍lr12关联,响应乱码,主要内容包括基础应用、实用技巧、原理机制等方面,希望对大家有所帮助。

一、前程贷登陆、投标脚本html

Action()
{
//    web_url("登陆页",
//        "URL=http://120.78.128.25:8765/Index/login.html",
//        "TargetFrame=",
//        "Resource=0",
//        "Referer=",
//        "Mode=HTML",
//        LAST);
//    
    

    web_reg_save_param_ex(
        "ParamName=get_login_result",
        "LB=<p class=\"success\">",
        "RB=</p>",
        "Ordinal=1",
        SEARCH_FILTERS,
        LAST);

    lr_start_transaction("登陆");

    web_submit_data("login",
        "Action=http://120.78.128.25:8765/Frontend/Index/login",
        "Method=POST",
        "TargetFrame=",
        "Referer=",
        "Mode=HTML",
        ITEMDATA,
        "Name=phone", "Value=13825161923", ENDITEM,
        "Name=password", "Value=lemon123", ENDITEM,
        "Name=remember_me", "Value=1", ENDITEM,
        "Name=notify_url", "Value=", ENDITEM,
        "Name=vcode", "Value=", ENDITEM,
        LAST);
    
    if(strcmp(lr_eval_string("{get_login_result}"),"登陆成功")==0)
    {

        lr_end_transaction("登陆", LR_PASS);
        lr_output_message("登陆结果:%s",lr_eval_string("{get_login_result}"));

    }
    else
    {
        lr_end_transaction("登陆", LR_FAIL);
        lr_error_message("登陆结果:%s",lr_eval_string("{get_login_result}"));

    
    }

    

    web_reg_save_param_ex(
        "ParamName=get_id",
        "LB=href=\"/loan/loan_detail/Id/",
        "RB=.html\" class",
        "Ordinal=1",
        SEARCH_FILTERS,
        LAST);

    
    web_url("首页",
        "URL=http://120.78.128.25:8765/Index/index",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        "Mode=HTML",
        LAST);
    
    web_reg_save_param_ex(
        "ParamName=get_token",
        "LB=\" data-token=\"",
        "RB=\" data-id=\"",
        "Ordinal=1",
        SEARCH_FILTERS,
        LAST);

    web_url("投标页面",
        "URL=http://120.78.128.25:8765/loan/loan_detail/Id/{get_id}.html",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        "Mode=HTML",
        LAST);
    

    web_reg_save_param_ex(
        "ParamName=get_state",
        "LB=\"state\":",
        "RB=,\"msg\":\"",
        "Ordinal=1",
        SEARCH_FILTERS,
        LAST);

    lr_start_transaction("投标");
//
    web_submit_data("投标",
        "Action=http://120.78.128.25:8765/Invest/invest",
        "Method=POST",
        "TargetFrame=",
        "Referer=",
        "Mode=HTML",
        ITEMDATA,
        "Name=id", "Value={get_id}", ENDITEM,
        "Name=val", "Value=200", ENDITEM,
        "Name=token", "Value={get_token}", ENDITEM,
        "Name=rewardValue", "Value=0", ENDITEM,
        LAST);

    

    if(strcmp(lr_eval_string("{get_state}"),"1")==0)
       {
       

       lr_end_transaction("投标", LR_PASS);
       lr_output_message("投标成功,状态:%s",lr_eval_string("{get_state}"));

       }
    else
    {
    lr_end_transaction("投标", LR_FAIL);
    lr_error_message("投标失败,状态:%s",lr_eval_string("{get_state}"));
    }
    
    return 0;
}web

二、调试过程当中,记得把日志从标准模式调成拓展模式;在runtimes settings里的General   -〉 logurl

三、乱码处理:在runtime  settings 里的preferences,点击options,找到General调试

 

 

 

四、总结(web_reg_save_param和web_reg_save_param_ex)区别日志

二者的功能差很少,但web_reg_save_param_ex功能更强大,能够截取得到字符串code