LR函数基础(一)

函数用到:web_reg_find()、 lr_log_message()、 lr_eval_string()、strcmp()、atoi()

Action()
{
    web_reg_find("Text=liuej", "SaveCount=para_count", LAST); //文本检查,且保存变量

  web_submit_form("login.pl",
  "Snapshot=t3.inf",
  ITEMDATA,
  "Name=username", "Value={useranme}", ENDITEM,
  "Name=password", "Value={password}", ENDITEM,
  "Name=login.x", "Value=59", ENDITEM,
  "Name=login.y", "Value=1", ENDITEM,
  LAST);

 lr_log_message("username=%s  password=%s", lr_eval_string("{useranme}"), lr_eval_string("{password}"));

    lr_log_message("count= %d",lr_eval_string("{para_count}"));

    if (atoi(lr_eval_string("{para_count}"))>0)     //法1.验证是否找到了页面上的要检查的字符串
        lr_output_message("we find the string!");
 else
  lr_output_message("sorry,don't find the string!");


 if(strcmp(lr_eval_string("{para_count}"),"0")>0)  // 法2.验证是否找到了页面上的要检查的字符串
  lr_output_message("find");
 else
  lr_output_message("not find");

 return 0;
}

原文地址:https://www.cnblogs.com/shengs/p/4399691.html