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 ...
随机推荐
- sql 查询执行的详细时间profile
1.查看profile的设置 SHOW VARIABLES LIKE '%profil%' 结果如下:profiling OFF 为关闭状态 2.开启profile 结果: 3.执行需要执行的sql ...
- fopen中r+和w+的区别
r+: Open for reading and writing. The stream is positioned at the beginning of the file. w+:Open ...
- liunx之:ln命令
linux 一个很重要的命令 它的功能是为某一个文件在另外一个位置建立一个同步的链接,这个命令最常用的参数是-s,具体用法是: ln -s 源文件 目标文件 -s 是 symbolic的意思 ...
- VS2008基于对话框的MFC上位机串口通信(C++实现)简单例程
首先,在 vs2008 环境下创建 MFC 运用程序 设置项目名称为 ComTest(这个地方随意命名,根据个人习惯),点击确定后,点击下一步 出现如下界面 选择"基于对话框"模式 ...
- (转)Three challenges you’re going to face when building a chatbot
转自:https://blog.infermedica.com/three-challenges-youre-going-to-face-when-building-a-chatbot/ ...
- [Android] ADB操作相关经验
1.手机必须先root,小米可以安卓开发版系统即可.(注意:usb设置为调试模式) 2.安卓 adb工具(android debug bridge) 3.依次执行下面的命令: #adb root 获得 ...
- MyBatis入门学习教程-解决字段名与实体类属性名不相同的冲突
在平时的开发中,我们表中的字段名和表对应实体类的属性名称不一定都是完全相同的,下面来演示一下这种情况下的如何解决字段名与实体类属性名不相同的冲突. 一.准备演示需要使用的表和数据 CREATE TAB ...
- CFDebug.template
{ "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "Cre ...
- linux中如何启动和关闭svn
1,启动SVN sudo svnserve -d -r /home/data/svn/ 其中 -d 表示守护进程, -r 表示在后台执行 /home/data/svn/ 为svn的安装目录 2,关闭 ...
- Swift 简介
1.swift支持所有C和Obeject-c的基本类型,支持面向过程和面向对象的编程机制. 2.swift提供了2种功能强劲的集合类型:数组和字典 3.元祖 4.可选类型 5.swift 是一种类型安 ...