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的更多相关文章

  1. QTP学习笔记--Excel数据源

    直接读取Excel表格的function摘自此处http://www.51testing.com/html/40/307440-827863.html  特此感谢! Excel作为QTP自动化测试的数 ...

  2. QTP学习笔记--define new test object

    目前在测的系统里,有图片控件,图片源都是一样的,链接地址不同(链接地址是动态变化的,不适合作为属性). QTP的识别机制是根据Index来的,复制对象之后更改Index的属性方法无效,采用define ...

  3. QTP学习笔记---datatable应用

    DataTable应用1.定位数据行 DataTable.GetSheet() 2.获取当前行 GetCurrentRow3.获取指定行的值 getValueByRow = DataTable.Get ...

  4. QTP学习笔记1

    1.将变量值写入datatable/ 从datatable中取值赋给变量 DataTable("列名","sheet名") = 变量名 变量名 = DataTa ...

  5. 【工作笔记】BAT批处理学习笔记与示例

    BAT批处理学习笔记 一.批注里定义:批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩展名为BAT或者CMD,这些命令统称批处理命令. 二.常见的批处理指令: 命令清单: 1.RE ...

  6. php入门学习笔记

    学习笔记[6.5-6.13] 1.常用命令 打开数据库格式: mysql -h主机地址 -u用户名 -p 重启nginx:sudo /etc/init.d/nginx restart或者service ...

  7. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  8. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  9. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

随机推荐

  1. 安装Adobe系列时遇到的问题解决

    安装错误,错误摘要如下: Exit Code: 6 Please see specific errors below for troubleshooting. For example, ERROR: ...

  2. 关于 一开始不懂得 hosts配置。

    是转载别人的. 原文: http://my.oschina.net/cxz001/blog/298228   感谢分享: 一开始抄着陪着win下的hosts文件.然后配置  apache中的hosts ...

  3. EnumRemarkAttribute,获取属性值

    首先自定义一个RemarkAttribute [html] view plain copy using System;  using System.Collections.Generic;  usin ...

  4. HelloWorld[Java]

    public class HelloWorld{ public static void main(String args[]){ System.out.println("HelloWorld ...

  5. [转]require(),include(),require_once()和include_once()区别

    require(),include(),require_once()和include_once()区别 面试中最容易提到的一个PHP的问题,我想和大家共勉一下: require()和include() ...

  6. Javascript模式(第二章基本技巧)------读书笔记

    本章主要帮助大家写出高质量的JS代码的方法,模式和习惯,例如:避免使用全局变量,使用单个的var变量声明,缓存for循环的长度变量length等 一.尽量避免使用全局变量 1 每一个js环境都有一个全 ...

  7. jQuery EasyUI:根据数据库内容生成适合于easyui-tree的JSON数据格式

    1,jQuery EasyUI中easyui-tree特定的JSON数据格式 [ {"id":1,"text":"某公司","ch ...

  8. winform中dataGridView隔行显示不同的背景色,鼠标移动上显示不同颜色,离开后变回原色

    winform中dataGridView隔行显示不同的背景色,鼠标移动上显示不同颜色,离开后变回原色 先设置奇数行颜色,这个有个自带的属性AlternatingRowsDefaultCellStyle ...

  9. sqlserver添加表、字段注释

    引用 :http://begoodluck.blog.163.com/blog/static/20450728020141191412788/ 1.sqlserver用语句给表注释EXECUTE sp ...

  10. AWS CloudFormation Template

    { "AWSTemplateFormatVersion" : "2010-09-09", "Parameters" : { "Ba ...