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 ...
随机推荐
- Linux 下如何安装软件
一.解析Linux应用软件安装包 通常Linux应用软件的安装包有三种: 1) tar包,如software-1.2.3-1.tar.gz.它是使用UNIX系统的打包工具tar打包的. 2) rpm包 ...
- osx下配置Cocos2d-x 3.x Android开发环境
配置前需要准备的 首先需要看一下官网文档 http://www.cocos.com/doc/article/index?type=cocos2d-x&url=/doc/cocos-docs-m ...
- 一些好的python IDE
pyscipter 是一个不错的选择,快速灵巧.功能丰富.它的安装包只有五六兆,功能却一个都不少.语法高亮功能也很强,运算符.数字.hex都能按照你的需要改变颜色.还有非常灵敏的code comple ...
- php中判断字符串是否全是中文或含有中文的实现代码
<?php header('Content-type:text/html; charset=utf-8'); $str = '你好'; if(preg_match('/^[\x{4e00}-\x ...
- CSRF攻击
1.什么是CSRF攻击CSRF(Cross-site request forgery),跨站请求伪造.CSRF攻击的原理如下:1)用户登录正常的网站A后,在本地生成Cookie2)在不登出A的情况下, ...
- 欢迎你,phpWeChat 开发者
感谢您使用 phpWeChat 来作为自己网站或者微信公共号的开发工具.phpWeChat 是一款高效.稳定的网站+微信公共号内容管理系统(CMS),也可称之为一个PHP开发框架. phpWeChat ...
- GP 环境参数名称列表
Using environment settings In this topic About using environment settings Environment settings summa ...
- Turn off Debug Logging in Quartz .Net
Quartz.net uses Common.Logging, so something like this in your App.config/Web.config: <configSect ...
- LeetCode "Largest Divisible Subset" !
Very nice DP problem. The key fact of a mutual-divisible subset: if a new number n, is divisible wit ...
- Install CodeBlocks in CentOS 7
- For now, CodeBlocks doesn't privide binary packages for CentOS7.(http://www.codeblocks.org/downloa ...