zoukankan      html  css  js  c++  java
  • lr中web_reg_find函数

    一、函数的作用
    搜索web页面中html的代码
    二、函数的属性
    1.text:要搜索的字符串。如text="search"
    2.textpfx:搜索词的左边界
    3.textsfx:搜索词的右边界
    4.search:搜索的范围,只搜索头文件,或搜索body。默认是搜索全部。
    5.savecount:记录搜索到的字符的个数
    6.fail:指明fail的条件。如fail=found,则找到为失败
    7.found
    8.id:
    三、例子

    Example 1

    In the following example, web_reg_find function searches for the text string "Welcome". If the string is not found, it fails and the script execution stops.

    web_reg_find("Text=Welcome", LAST);

    web_url("Step", "URL=...", LAST);

    Example 2

    In the following example, web_reg_find function searches for the text string "Error". If the string is found, it fails and the script execution stops.

    web_reg_find("Text/IC=Error", "Fail=Found", LAST);

    web_url("Step", "URL=...", LAST);

    Example 3

    In the following example, web_reg_find function searches for the text string "ABC". If the string is not found, the script executes Action A. If the string is found one or more times, it executes Action B.

    web_reg_find("Text=ABC", "SaveCount=abc_count", LAST);

    web_url("Step", "URL=...", LAST);

    if (strcmp(lr_eval_string("{abc_count}"), "0") == 0)

    Action A

    else

    Action B

    Example 4

    In the following example, an ID argument "XYZ" associates the call to web_reg_find with a line in the log file. If you have to look for the entry in the log file that logged the call to web_reg_find, searching for the string "XYZ" will make it much easier.

    web_reg_find("Text=mitcham", ID=XYZ", LAST);
    web_url("web_url", "URL=http://lazarus/", "TargetFrame=",
              "Resource=0", "Referer=", LAST);

    The entries in the log file will be one of the following, depending on whether the web_reg_find succeeded in finding the text "mitcham" was found:

    Action1.c(12): Matched web_reg_find with "Fail=NotFound" ("XYZ"). Text "mitcham" (count=78)

    Action1.c(10): Error: No match for web_reg_find with "Fail=NotFound" ("XYZ"). Text "mitcham"

  • 相关阅读:
    CentOS上手动配置nginx.services
    Mac安装软件时,提示文件已损坏,需要移动到废纸篓的解决方法
    Jumpserver安装部署
    Linux服务器测试带宽
    Zabbix_server执行window脚本出现中文乱码如何解决
    四行shell脚本实现Zabbix_server 的高可用
    Kubernetes Pod故障归类与排查方法
    Nginx配置location与rewrite规则教程
    ipa文件信息检查工具
    申请免费SSL证书
  • 原文地址:https://www.cnblogs.com/morebetter/p/210785.html
Copyright © 2011-2022 走看看