• 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"

  • 相关阅读:
    基于Java+Selenium的WebUI自动化测试框架(四)-----设置监听类
    基于Java+Selenium的WebUI自动化测试框架(三)------记录LOG
    基于Java+Selenium的WebUI自动化测试框架(二)-----页面操作接口
    基于Java+Selenium的WebUI自动化测试框架(一)---页面元素定位器
    疯狂java笔记(七)
    使用python实现栈和队列
    Android定位方式和测试方法
    Robotium原理初探
    Android内存进程管理机制
    疯狂java笔记(五)
  • 原文地址:https://www.cnblogs.com/morebetter/p/210785.html
Copyright © 2020-2023  润新知