其他分享
首页 > 其他分享> > 常用函数

常用函数

作者:互联网

https://www.cnblogs.com/qmfsun/p/4487915.html

常用函数

Java Vuser  协议脚本

Web-HTML/HTTP协议脚本

引用类
或库文件

import lrapi.lr;
import lrapi.web;

通过globals.h文件引用

think_time

lr.think_time(3);

lr_think_time(3);

transaction

lr.start_transaction("事务");
......
lr.end_transaction("事务", lr.AUTO);

lr_start_transaction("事务");
......
lr_end_transaction("事务", LR_AUTO);

set_option

web.set_option("MaxRedirectionDepth", "0",
new String[]{"LAST"});

web_set_option("MaxRedirectionDepth", "0",
LAST );

set_user

web.set_user("cluster",
//lr.decrypt("58cf7265b1677820107f74"),
        "cluster",
        "172.17.2.89:8081");

web_set_user("cluster",
        //lr_decrypt("58cf7265b1677820107f74"),
        "cluster",
        "172.17.2.89:8081");

add_header

web.add_header("Authorization",
lr.eval_string("<BasicAuth>"));

web_add_header("Authorization",
lr_eval_string("{BasicAuth}"));

output
message

lr.save_string("test","tParam");
lr.output_message("tParam的值为:"
      +lr.eval_string("<tParam>"));

lr_save_string("test","tParam");
lr_output_message("tParam的值为:%s",
      lr_eval_string("{tParam}"));

web_url

web.url("Show status",
    "URL=http://172.17.2.89:8081/kettle/status/",
    new String[]{
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://172.17.2.89:8081/",
        "Snapshot=t3.inf",
        "Mode=HTTP",
        "LAST"});

web_url("Show status",
    "URL=http://172.17.2.89:8081/kettle/status/",
    "Resource=0",
    "RecContentType=text/html",
    "Referer=http://172.17.2.89:8081/",
    "Snapshot=t3.inf",
    "Mode=HTTP",
    LAST);

web_
submit_data

web.submit_data("executeJob",
    "Action=http://172.17.2.89:8081/kettle/executeJob/",
    new String[]{
        "Method=POST",
        "RecContentType=text/html",
        "Referer=",
        "Mode=HTTP"},
    new String[]{// "ITEMDATA",  不要加这条
        "Name=job", "Value=/DZ/job/HYHZ", "ENDITEM",
        "Name=level", "Value=Debug", "ENDITEM",
        "Name=rep", "Value=DZHY0620", "ENDITEM",
        "LAST"});

web_submit_data("executeJob",
    "Action=http://172.17.2.89:8081/kettle/executeJob/",
    "Method=POST",
    "RecContentType=text/html",
    "Referer=",
    "Mode=HTTP",
    ITEMDATA,
        "Name=job", "Value=/DZ/job/HYHZ", ENDITEM,
        "Name=level", "Value=Debug", ENDITEM,
        "Name=rep", "Value=DZHY0620", ENDITEM,
    LAST);

web_
custom_request

String htmlBody="这里是body串";
web.custom_request("ViewStreamLogin",
    "Method=POST",
    new String[]{
        "URL=http:/*.*.cn/login?user=test&passwd=123",
        htmlBody,
        "TargetFrame=",
        "Referer=",
        "Mode=HTTP",
        "LAST"});

web_custom_request("ViewStreamLogin",
    "URL=http:/*.*.cn/login?user=test&passwd=123",
    "Method=POST",
    "TargetFrame=",
    "Resource=0",
    "Referer=",
    "Mode=HTTP",
    "Body=这里是body串",
    LAST);

web_
submit_form

web.submit_form("authenticate",
    new String[]{
        "Snapshot=t2.inf"},
    new String[]{
        "Name=user", "Value=root", ENDITEM,
        "Name=passwd", "Value=2012", ENDITEM,
        "Name=key", "Value=<OFF>", ENDITEM,
        "LAST"});

web_submit_form("authenticate",
    "Snapshot=t2.inf",
    ITEMDATA,
        "Name=user", "Value=root", ENDITEM,
        "Name=passwd", "Value=2012", ENDITEM,
        "Name=key", "Value={OFF}", ENDITEM,
    LAST);

标签:web,常用,LAST,函数,Value,lr,Name,ENDITEM
来源: https://www.cnblogs.com/wbw-test/p/11507156.html