QTP学习笔记之—VBS
1、ToString() : Returns a string that represents the current test object.
Example
The following example uses the ToString method to generate a report detailing the dimensions of a MainFrame test object.
Sub ReportRectangle(obj) x = obj.GetTOProperty("abs_x") y = obj.GetTOProperty("abs_y") w = obj.GetTOProperty("width") h = obj.GetTOProperty("height") Reporter.ReportEvent micDone, obj.ToString() & " dimensions", "The Virtual object " & obj.ToString() & " is defined using the following dimensions: " & x & ", " & y & ", " & x+w & ", " & y+h End Sub 'Sample usage
ReportRectangle Browser("XXXX平台").Page("XXXX平台").Frame("mainFrame")
2、Generate a Report Detailing the Content of an Edit Box
Function VerifyTextPropertyNotEmpty(obj) Text = obj.GetROProperty("text") If Text = "" Then Reporter.ReportEvent micFail, obj.ToString() & " Text Verification", "Verification Failed. " & obj.ToString() & " does not have a text value." VerifyTextPropertyNotEmpty = False Else Reporter.ReportEvent micPass, obj.ToString() & " Text Verification", "Verification Passed. The " & obj.ToString() & " contains the following text: " & Text VerifyTextPropertyNotEmpty = True End If End Function
3、Verify the Number of Items in a List.
Sub CheckProperty_Example() 'The following example uses the CheckProperty method to verify the 'number of items in a WebList. Note that if the original count 'is not equal to 15, an error message is displayed in the Test Results. Browser("Fill-Out Form Example").Page("Fill-Out Form Example").WebList("what-to-do").CheckProperty "items count", 15, TimeLimitation Item_Count = Browser("Fill-Out Form Example").Page("Fill-Out Form Example").WebList("what-to-do").GetROProperty("items count") If Item_Count = 15 Then 'Remove one item from the list Browser("Fill-Out Form Example").Page("Fill-Out Form Example").WebButton("Remove Item From List").Click 'Check if the item was removed from the list Browser("Fill-Out Form Example").Page("Fill-Out Form Example").WebList("what-to-do").CheckProperty "items count", 14, TimeLimitation Else Reporter.ReportEvent micFail, "Number Of List Items", "The item count in the list should be 15, not " & Item_Count & "." End If End Sub
QTP学习笔记之—VBS的更多相关文章
- QTP学习笔记--Excel数据源
直接读取Excel表格的function摘自此处http://www.51testing.com/html/40/307440-827863.html 特此感谢! Excel作为QTP自动化测试的数 ...
- QTP学习笔记--define new test object
目前在测的系统里,有图片控件,图片源都是一样的,链接地址不同(链接地址是动态变化的,不适合作为属性). QTP的识别机制是根据Index来的,复制对象之后更改Index的属性方法无效,采用define ...
- QTP学习笔记---datatable应用
DataTable应用1.定位数据行 DataTable.GetSheet() 2.获取当前行 GetCurrentRow3.获取指定行的值 getValueByRow = DataTable.Get ...
- QTP学习笔记1
1.将变量值写入datatable/ 从datatable中取值赋给变量 DataTable("列名","sheet名") = 变量名 变量名 = DataTa ...
- 【工作笔记】BAT批处理学习笔记与示例
BAT批处理学习笔记 一.批注里定义:批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩展名为BAT或者CMD,这些命令统称批处理命令. 二.常见的批处理指令: 命令清单: 1.RE ...
- php入门学习笔记
学习笔记[6.5-6.13] 1.常用命令 打开数据库格式: mysql -h主机地址 -u用户名 -p 重启nginx:sudo /etc/init.d/nginx restart或者service ...
- js学习笔记:webpack基础入门(一)
之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...
- PHP-自定义模板-学习笔记
1. 开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2. 整体架构图 ...
- PHP-会员登录与注册例子解析-学习笔记
1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...
随机推荐
- lua Getter&Setter简单实现
lua是一门简单的语言,不带类和属性封装,但可以使用lua强大的元表模拟实现: class.lua local type = type local rawset = rawset local setm ...
- Ext.Net 学习随笔 002 默认按钮
在FormPanel中按回车按键,会触发默认按钮的click事件.设置方法为在FormPanel中设置DefaultButton属性,如果没有设置这个属性,默认为最后一个按钮. 1.缺省最后一个按钮为 ...
- JS 控制CSS样式表
JS控制CSS所使用的方法: <style> .rule{ display: none; } </style> 你想要改变把他的display属性由none改为inline. ...
- 10天学会phpWeChat——第一天:核心框架的目录结构
phpWeCaht是一款优秀的PC网站+微信公共号开发框架. 本博客系列将图文结合,详细介绍phpWeChat 的使用方法,今天进入phpWeChat系列教程之<10天学会phpWeChat&g ...
- Eclipse搭建SSH(Struts2+Spring+Hibernate)框架教程
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 确实,刚创博客,对于这个陌生的东西还是有些许淡然.这是我的第一篇博文,希望能给你们有帮助,这就是我最大的乐趣! 好了下面进入正题: SS ...
- oracle备份工具exp-imp
rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpmrpm -ivh http: ...
- 自己动手制作CSharp编译器
在你喜欢的位置(如F盘根目录)新建一个文件夹,并命名为“CSharp开发环境”.找到或下载C#编译器组件(csc.exe和cscui.exe),并放在先前建立的文件夹中.该组件的一般位置在C盘的.NE ...
- [Linux] - CentOS IP设置方法
CentOS 7的IP设置方法: 1.手动设置IP方法 a) 运行命令,cd到目录: cd /etc/sysconfig/network-scripts/ b) 运行命令:ls -l 找到类似这个文件 ...
- AspNetPager控件报错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$Aspnetpager1_input问题解决[摘]
高版本IE,如IE10或者IE11在浏览页面时出现错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$ ...
- [git]rebase和merge
转自:http://blog.csdn.net/wh_19910525/article/details/7554489 Git merge是用来合并两个分支的. git merge b # 将b分支合 ...