51Testing软件测试论坛

标题: web_find 及变更传递的使用方法 [打印本页]

作者: tianwds    时间: 2005-12-22 12:32
标题: web_find 及变更传递的使用方法
#include "web_api.h"
#include "lrw_custom_body.h"


vuser_init()
{

    web_add_cookie("username=enpo; DOMAIN=88.148.0.133");

        web_url("jh",
                "URL=http://88.148.0.133:7001/jh/",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);

        web_submit_form("login.do;jsessionid=DGqvsmYDVSpC62B12xhrz70Y2LW82vJsjQ3Byjv5dHLPbBzcmNsV!-1895023105",
                "Snapshot=t2.inf",
                ITEMDATA,
                "Name=formvalue(username)", "Value={UName}", ENDITEM,
                "Name=formvalue(password)", "Value={pwd}", ENDITEM,
                "Name=formvalue(saveme)", "Value=<OFF>", ENDITEM,
                LAST);

//将当前用户赋值给变量"MY_name"
     lr_save_string(lr_eval_string("{UName}"), "MY_name");
     lr_output_message("当前登录的用户是:%s",lr_eval_string("{MY_name}"));
//搜索当前登录用户名
web_find("my find",
        "expect=notfound",
        "matchcase=no",
        "onfailure=abort",
        "report=failure",
        "repeat=no",
        "what={MY_name}",
        LAST);
       

//    lr_vuser_status_message("当前用户史称是是:%s",lr_eval_string("{pwd}"));
    lr_vuser_status_message("密码是:%s",lr_eval_string("{pwd}"));
          return 0;
}




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