int web_find( const char *StepName, <Attributes and Specifications list>, char *searchstring, LAST ); 
 
StepName:步骤名称,必选
Attributes and Specifications list:属性列表,可选
    expect:定义返回成功的标准,found(默认)-表示找到字符串返回成功,notfound-表示未找到字符串返回成功
    Matchcase:是否区分大小写,yes-表示区分大小写,no(默认)-表示不区分大小写
    report:定义结果报告的内容,success-只包含成功,failure-只包含失败,always(默认)-包含所有
    onfailure=abort:失败则终止脚本运行
    RightOf:从指定字符串的右边开始查找
    LeftOf:从指定字符串的左边开始查找
searchstring:查找的字符串,格式为:"What=stringxyz",必选
LAST:结束标记,必选
 
 

WebTours登录后页面展示的内容:

Welcome, jojo, to the Web Tours reservation pages.
Using the menu to the left, you can search for new flights to book, or review/edit the flights already booked. Don't forget to sign off when you're done!
 
 
1、web_find之expect属性:
Action()
{ web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t34.inf",
"Mode=HTML",
EXTRARES,
"Url=../favicon.ico", "Referer=", ENDITEM,
LAST); web_submit_form("login.pl",
"Snapshot=t35.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=52", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST); web_find("web_find",
//期望返回成功的结果是找到字符串,因当前页面包含要查找的字符串,故返回结果是成功
"expect=found",
//当前页面中查找字符串"jojo"
"What=jojo",
LAST); web_find("web_find",
//期望返回成功的结果是未找到字符串,因当前页面包含要查找的字符串,故返回结果是失败
"expect=notfound",
//当前页面中查找字符串"jojo"
"What=jojo",
LAST); return ;
}

代码执行结果:

Action.c(24): "web_find" successful. 1 occurrence(s) of "jojo" found (RightOf="", LeftOf="")   [MsgId: MMSG-27196]

Action.c(24): web_find was successful   [MsgId: MMSG-26392]

Action.c(31): Error -27195: "web_find" failed. 1 occurrence(s) of "jojo" found (RightOf="", LeftOf="")   [MsgId: MERR-27195]

Action.c(31): web_find highest severity level was "ERROR"   [MsgId: MMSG-26391]

 
 
2、web_find之Matchcase属性:
Action()
{ web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t34.inf",
"Mode=HTML",
EXTRARES,
"Url=../favicon.ico", "Referer=", ENDITEM,
LAST); web_submit_form("login.pl",
"Snapshot=t35.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=52", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST); web_find("web_find",
//区分大小写,因当前页面不包含JOJO,故返回结果是失败
"Matchcase=yes",
//当前页面中查找字符串"JOJO"
"What=JOJO",
LAST); web_find("web_find",
//不区分大小写,因当前页面包含jojo,故返回结果是成功
"Matchcase=no",
//当前页面中查找字符串"JOJO"
"What=JOJO",
LAST); return ;
}

代码执行结果:
Action.c(24): Continuing after Error -27195: "web_find" failed. 0 occurrence(s) of "JOJO" found (RightOf="", LeftOf="")   [MsgId: MERR-27195]
Action.c(24): web_find highest severity level was "continue on error"   [MsgId: MMSG-26391]
Action.c(24): Continuing after error in Vuser script.
Action.c(31): "web_find" successful. 1 occurrence(s) of "JOJO" found (RightOf="", LeftOf="")   [MsgId: MMSG-27196]
Action.c(31): web_find was successful   [MsgId: MMSG-26392]
 
 
3、web_find之onfailure属性:
Action()
{ web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t34.inf",
"Mode=HTML",
EXTRARES,
"Url=../favicon.ico", "Referer=", ENDITEM,
LAST); web_submit_form("login.pl",
"Snapshot=t35.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=52", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST); web_find("web_find",
//如果函数返回结果失败,则终止脚本运行,根据运行结果可以发现,第二个web_find没有运行
//注意:Continue on Error 设置了才能看到效果,否则的话,不管是否有该属性都会终止运行
"onfailure=abort",
//当前页面中查找字符串"JOJO"
"What=jojo1",
LAST); web_find("web_find",
//当前页面中查找字符串"JOJO"
"What=jojo",
LAST); return ;
}
 
代码运行结果:
Action.c(24): Fatal Error -27195: "web_find" failed. 0 occurrence(s) of "jojo1" found (RightOf="", LeftOf="")   [MsgId: MERR-27195]
Action.c(24): web_find highest severity level was "FATAL ERROR"   [MsgId: MMSG-26391]
Abort was called from an action.
 
 
4、web_find之LeftOf、RightOf属性:
Action()
{ web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t34.inf",
"Mode=HTML",
EXTRARES,
"Url=../favicon.ico", "Referer=", ENDITEM,
LAST); web_submit_form("login.pl",
"Snapshot=t35.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=52", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST); web_find("web_find",
//从, to the Web左边查找jojo
"LeftOf=, to the Web",
//从Welcome右边查找jojo
"RightOf=Welcome, ",
"What=jojo",
LAST); return ;
}

代码运行结果:
Action.c(24): "web_find" successful. 1 occurrence(s) of "jojo" found (RightOf="Welcome, ", LeftOf=", to the Web")   [MsgId: MMSG-27196]
Action.c(24): web_find was successful   [MsgId: MMSG-26392]

loadRunner函数之web_find的更多相关文章

  1. LoadRunner 函数大全之中文解释

    LoadRunner 函数大全之中文解释 // sapgui_table_set_column_selected 模拟用户 // 单击表中的列标题. int sapgui_table_set_colu ...

  2. LoadRunner函数百科叒叒叒更新了!

    首先要沉痛通知每周四固定栏目[学霸君]由于小编外派公干,本周暂停. 那么这周就由云层君来顶替了,当然要要说下自己做的内容啦,DuangDuang! <LoadRunner函数百科>更新通知 ...

  3. myeclipse调用loadrunner函数开发测试脚本

    myeclipse调用loadrunner函数开发测试脚本 一.使用myeclipse开发性能测试脚本 1.使用Eclipse新建一个Java工程,将目录%LoadRunner_Home%\class ...

  4. LoadRunner函数大全之中文解释

    LoadRunner函数大全之中文解释

  5. 软件测试中LoadRunner函数中的几个陷阱

    软件测试 中 LoadRunner 函数中的几个陷阱 1.atof 在 loadrunner 中如果直接用 float f; f=atof("123.00"); lr _outpu ...

  6. LoadRunner函数的介绍

    LoadRunner函数的介绍 LoadRunner函数 一:通用函数 LoadRunner的通用函数以lr为前缀,可以在任何协议中使用.可以如下分类: 信息相关的函数: lr_error_messa ...

  7. LoadRunner函数

    一.基础函数简介 在VU左边导航栏中,有三个LoadRunner框架函数,分别是vuser_init().Action().vuser_end().这三个函数存在于任何Vuser类型的脚本中. vus ...

  8. LoadRunner函数示例:lr_paramarr_random()

    lr_paramarr_random()函数的作用为:从一个参数数组中随机抽取一个值并以字符串形式返回.其使用方式及返回方式如下: char * lr_paramarr_random( const c ...

  9. loadrunner函数解密之web_reg_save_param

    loadrunner工具的使用,最关键的在于3个地方: A:脚本的编写 B:场景设计 C:性能测试结果分析 其 中难度比较大的第一步是:编写脚本,有很多人对于loadrunner里面的各种函数使用的并 ...

随机推荐

  1. 【HDOJ6578】Blank(DP)

    题意:一个长为n的序列,每个位置上的值是0,1,2,3中的一个,有m个限制条件,限制位置[l[i],r[i]]中不同的数值有x[i]个,问方案数MOD 998244353 n<=100,m< ...

  2. Delphi读取和写入utf-8编码格式的文件

    读取UTF-8格式的文件内容 function LoadUTF8File(AFileName: string): string; var ffileStream:TFileStream; fAnsiB ...

  3. python常用安装

    pip install CalledProcessErrorpip install Popenpip install runpip install requests

  4. window系统命令cmd有哪些?

    CMD命令:开始->运行->键入cmd或command(在命令行里可以看到系统版本.文件系统版本)chcp 修改默认字符集chcp 936默认中文chcp 650011. appwiz.c ...

  5. [CSP-S模拟测试]:attack(支配树+LCA+bitset)

    题目传送门(内部题55) 输入格式 第一行,包含两个整数:$n,m,q$,表示敌军城市数.路数和情报数.接下来$m$行,每行包含两个整数:$u,v$,表示从$u$到$v$包含一条单向道路.接下来$q$ ...

  6. xunit的assert常用部分方法解释

    布尔:True(返回bool的方法或者字段) 判断是否为trueFalse(返回bool的方法或者字段) 判断是否为false 字符串(区分大小写):Equal(期待结果,实际结果) 判断输出值和期待 ...

  7. jquery 自定义类

    jQuery自定义类封装: (function ($) { $.DragField = function (arg) { var name = "你好"; //这个是私有变量,外部 ...

  8. 杂项:电子表格程序-u

    ylbtech-杂项:电子表格程序-u 1.返回顶部 1.1 https://www.gemboxsoftware.com/spreadsheet 1.1 https://www.spreadshee ...

  9. 用 Flask 来写个轻博客 (25) — 使用 Flask-Principal 实现角色权限功能

    目录 目录 前文列表 扩展阅读 Flask-Principal 使用 Flask-Principal 来实现角色权限功能 添加 Role Model 在 Manager shell 中手动的添加角色 ...

  10. PHP+JS的信息提示弹窗

    基于PHP函数的Msg信息提示框 1.可以设置弹出信息,跳转地址,跳转的时间,跳转的信息标题提示: 2.代码实例: <?php function ShowMsg($msg, $gourl,$ti ...