9:41 PM
GAReddy
0
QTP - Getting Object Properties Dynamically
QTP
- Getting Object Properties Dynamically
'************************************************************************
' Get Value Property
'************************************************************************
'Return the object 'Value' property
'Description Returns the Object value
Public Function GetValueProperty (obj)
GetValueProperty =
obj.GetROProperty("value")
End Function
'************************************************************************
' Get Text Property
'************************************************************************
'Return the object 'Text' property
'Description Returns the Object value
Public Function GetTextProperty (obj)
GetTextProperty =
obj.GetROProperty("text")
End Function
'************************************************************************
' Get Attached TextTProperty
'************************************************************************
'Return the object 'attached text' property
'Description Returns the Object attached text
Public Function GetAttachedTextProperty (obj)
GetAttachedTextProperty =
obj.GetROProperty("attached text")
End Function
'************************************************************************
' Get Selection Property
'************************************************************************
'Return the object 'selection' property
'Description Returns the Object value
Public Function GetSelectionProperty (obj)
GetSelectionProperty =
obj.GetROProperty("selection")
End Function
'************************************************************************
' Get Checked Property
'************************************************************************
'Return the object 'checked' property
'Description Returns the Object value
Public Function GetCheckedProperty (obj)
GetCheckedProperty =
obj.GetROProperty("checked")
End Function
'************************************************************************
' Get Nativeclass Property
'************************************************************************
'Return the object 'nativeclass property
'Description Returns the Object nativeclass
Public Function GetNativeclassProperty (obj)
GetNativeclassProperty =
obj.GetROProperty("nativeclass")
End Function
'************************************************************************
' A Sample script to invoke Filght App and to
make use of the above functions
'This script calls the above functiolns and in
return gets the object properties
'************************************************************************
SystemUtil.Run "C:\Program Files\HP\QuickTest
Professional\samples\flight\app\flight4a.exe"
wait(2)
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent
Name:").Set "GAReddy"
'To get the Text Property of the
WinEdit AgentName field
Set obj=Dialog("Login").WinEdit("Agent
Name:")
Print "Nativeclass Property of the
Object ( Agent Name:) is --> " &
GetNativeclassProperty (obj)
Print "Text Property of the Object (
Agent Name:) is --> " &
GetTextProperty (obj)
Print "AttachedText Property of the
Object ( Agent Name:) is --> " & GetAttachedTextProperty
(obj)
Dialog("Login").WinEdit("Password:").Set
"MERCURY"
'To get the Text Property of the
WinButton OK field
Set
obj=Dialog("Login").WinButton("OK")
Print "Nativeclass Property of the Object
( OK) is --> " & GetNativeclassProperty (obj)
Print "Text Property of the Object
(OK) is -->" & GetTextProperty (obj)
Dialog("Login").WinButton("OK").Click
''***********************************************************************
9:36 PM
GAReddy
VB Script Features
VB Script Features
VB
Script Features
|
|
Category
|
Keywords
|
Array
handling
|
Array,
Dim, Private, Public, ReDim, IsArray, Erase, LBound, UBound
|
Assignments
|
Set
|
Comments
|
Comments
using ' or Rem
|
Constants/Literals
|
Empty,
Nothing, Null, True, False
|
Control
flow
|
Do...Loop,
For...Next, For Each...Next, If...Then...Else, Select Case, While...Wend,
With
|
Conversions
|
Abs,
Asc, AscB, AscW, Chr, ChrB, ChrW, CBool, CByte, CCur, CDate, CDbl, CInt,
CLng, CSng, CStr, DateSerial, DateValue, Hex, Oct, Fix, Int, Sgn, TimeSerial,
TimeValue
|
Dates/Times
|
Date,
Time, DateAdd, DateDiff, DatePart, DateSerial, DateValue, Day, Month,
MonthName, Weekday, WeekdayName, Year, Hour, Minute, Second, Now, TimeSerial,
TimeValue
|
Declarations
|
Class,
Const, Dim, Private, Public, ReDim, Function, Sub, Property Get, Property
Let, Property Set
|
Error
Handling
|
On
Error, Err
|
Expressions
|
Eval,
Execute, RegExp, Replace, Test
|
Formatting
Strings
|
FormatCurrency,
FormatDateTime, FormatNumber, FormatPercent
|
Input/Output
|
InputBox,
LoadPicture, MsgBox
|
Literals
|
Empty,
FALSE, Nothing, Null, TRUE
|
Math
|
Atn,
Cos, Sin, Tan, Exp, Log, Sqr, Randomize, Rnd
|
Miscellaneous
|
Eval
Function, Execute Statement, RGB Function
|
Objects
|
CreateObject,
Err Object, GetObject, RegExp
|
Operators
|
Addition
(+), Subtraction (-), Exponentiation (^), Modulus arithmetic (Mod),
Multiplication (*), Division (/), Integer Division (\), Negation (-), String
concatenation (&), Equality (=), Inequality (<>), Less Than (<),
Less Than or Equal To (<=), Greater Than (>), Greater Than or Equal To
(>=), Is, And, Or, Xor, Eqv, Imp
|
Options
|
Option
Explicit
|
Procedures
|
Call,
Function, Sub, Property Get, Property Let, Property Set
|
Rounding
|
Abs,
Int, Fix, Round, Sgn
|
Script
Engine ID
|
ScriptEngine,
ScriptEngineBuildVersion, ScriptEngineMajorVersion, ScriptEngineMinorVersion
|
Strings
|
Asc,
AscB, AscW, Chr, ChrB, ChrW, Filter, InStr, InStrB, InStrRev, Join, Len,
LenB, LCase, UCase, Left, LeftB, Mid, MidB, Right, RightB, Replace, Space,
Split, StrComp, String, StrReverse, LTrim, RTrim, Trim
|
Variants
|
IsArray,
IsDate, IsEmpty, IsNull, IsNumeric, IsObject, TypeName, VarType
|
9:32 PM
GAReddy
QTP - Descriptive Programming
QTP - Descriptive Programming
'####################################################
'# Descriptive Programming Objects > DPWebEdit
'####################################################
Public Sub DPWebEdit (strWebEdit,strInValue)
If strInValue <> "" Then
Set obj_WebEdit =
Description.Create
obj_WebEdit ("Class
Name").value = "WebEdit"
obj_WebEdit ("name").value=
strWebEdit
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).WebEdit(obj_WebEdit).Set
strInValue
End If
End Sub
'########################################################
'# Descriptive Programming Objects > DPWebEditSetSecure
'########################################################
Public Sub DPWebEditSetSecure
(strWebEdit,strInValue)
If strInValue <> "" Then
Set obj_WebEdit =
Description.Create
obj_WebEdit ("Class
Name").value = "WebEdit"
obj_WebEdit ("name").value=
strWebEdit
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).WebEdit(obj_WebEdit).SetSecure strInValue
End If
End Sub
'########################################################
'# Descriptive Programming Objects > DPWebList
'########################################################
Public Sub DPWebList (strWebList,strInValue)
If strInValue <> "" Then
Set obj_WebList =
Description.Create
obj_WebList ("Class
Name").value = "WebList"
obj_WebList
("name").value= strWebList
Reporter.Filter = 3 'Turn
Reporting of
Call TestListValues
(obj_WebList,strInValue)
'Check for valid item in list
Reporter.Filter = 0 'Turn
Reporting on
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).WebList(obj_WebList).Select
strInValue
End If
End Sub
'########################################################
'# Descriptive Programming Objects > DPRadioGroup
'########################################################
Public Sub DPRadioGroup
(strWebRadioGroup,strInValue)
Set obj_WebRadioGroup = Description.Create
obj_WebRadioGroup ("Class Name").value =
"WebRadioGroup"
obj_WebRadioGroup ("name").value=
strWebRadioGroup
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).WebRadioGroup(obj_WebRadioGroup).Select
strInValue
End Sub
'####################################################
'# Descriptive Programming Objects > DPWebImage
'########################################################
Public Sub DPWebImage (strImage)
Set obj_Image =
Description.Create
obj_Image ("Class
Name").value = "Image"
obj_Image ("name").value=
strImage
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).Image(obj_Image).Click
'6,7
End Sub
'####################################################
'# Descriptive Programming Objects > DPWebCheckBox
'########################################################
Public Sub DPWebCheckBox (strWebCheckBox,strInValue)
Set obj_WebRadioGroup = Description.Create
obj_WebCheckBox ("Class Name").value =
"WebCheckBox"
obj_WebCheckBox ("name").value=
strWebRadioGroup
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).WebCheckBox(obj_WebCheckBox).Select
strInValue
End Sub
'####################################################
'# Descriptive Programming Objects > DPWebLink
'########################################################
Public Sub DPWebLink
(strWebLink)
Set obj_WebLink = Description.Create
obj_WebLink ("Class Name").value =
"Link"
obj_WebLink ("name").value=
strWebLink
Count = 1
Do until
Browser(strBrowser).Page(strPage).Link(obj_WebLink).Exist
if
Browser(strBrowser).Page(strPage).Link(obj_WebLink).Exist Then
Exit Do
End
If
Count = Count +
1
If Count = 20 Then
Exit Do
end
if
Loop
Browser(strBrowser).Page(strPage).Link(obj_WebLink).Click
End Sub
'####################################################
'# Descriptive Programming Objects > DPWebButton
'########################################################
Public Sub DPWebButton (strWebButton)
Set obj_WebButton = Description.Create
obj_WebButton ("Class Name").value =
"WebButton"
obj_WebButton ("name").value=
strWebButton
Browser(strBrowser).page(strPage).Sync
Browser(strBrowser).Page(strPage).WebButton(obj_WebButton).Click
End Sub
'####################################################
GAReddy @ OneTestingCenter @ All Articles
- Ad-hoc Testing
- Automation Framework
- Basics of QTP
- Core Testing FAQs
- Download QTP - Preseenations
- Framework Guide
- Introduction to Testing
- ISTQB Foundation Level Exam Papers
- ISTQB Foundation Level Exam Sample Paper - I
- ISTQB Foundation Level Exam Sample Paper - II
- ISTQB Foundation Level Exam Sample Paper - III
- Keyword Driven Framework
- Keyword Driven Framework Complete Guide
- Keyword Framework Complete Guide
- Load
- Load Runner - Components
- Load Runner - Load Testing Process
- Load Testing - LoadRunner Correlation
- Load Testing Process
- Monkey Testing and Exploratory Testing
- Most Relevant Features and Benefits
- OneTestingCenter - Manual Testing - Learning Table
- Performance
- Performance Test - Short Notes
- Practical Guide to Keyword Driven Framework
- Programming Language / Scripting language / Markup languages / Operating Systems
- QTP QTP Learning Let's Learn QTP QTP Easy Learning QTP Guide QTP Book QTP Learning PDF QTP - Fundamentals QTP - Advanced QTP - Topic by Topic QTP Lessons GAReddy - QTP
- QTP - ActionDriven Framework Demo1
- QTP - Actions
- QTP - Application Relationship - Video
- QTP - Array Library Functions
- QTP - Automation Startup - Video
- QTP - Certification Q's1
- QTP - Certification Q's2
- QTP - Certification Q's3
- QTP - Data Tables
- QTP - DataTables - Video
- QTP - Descriptive Programing - Dynamic Object Repository Creation
- QTP - Descriptive Programming
- QTP - Descriptive Programming - Any Web App - Working with all Objects
- QTP - Descriptive Programming - Any Web App - Working with Web List-boxes
- QTP - Descriptive Programming - Broken Link Checking
- QTP - Descriptive Programming - Working with Any Web App
- QTP - Dictionary Object - Creating a Dictionary Object
- QTP - Dictionary Object - Add Method
- QTP - Dictionary Object - Items
- QTP - Dictionary Object - KeyExists
- QTP - Dictionary Object - Keys
- QTP - Dictionary Object - Remove Method
- QTP - Dictionary Object - RemoveAll Method
- QTP - Dictionary Object - Using Dictionary Values As Variables
- QTP - Environment Variables
- QTP - Excel - Excel Comparison
- QTP - Excel Comparision
- QTP - Files - Files Comparison
- QTP - Files Comparision
- QTP - Files Comparison
- QTP - FSO (PART A)
- QTP - FSO (PART B)
- QTP - Getting Object Properties Dynamically
- QTP - GetTOProperties / GetTOProperty / SetTOProperty Demo
- QTP - GetTOProperties Script Demo
- QTP - GetTOProperty Script Demo
- QTP - InputBox
- QTP - Keyword Driven Automation Framework - Video
- QTP - Keyword Driven Framework - Complete Guide
- QTP - Keyword Driven Framework - Complete Guide - Video
- QTP - Keyword Driven Framework - Step by Step Guide
- QTP - Microsoft Office - Word
- QTP - MsgBox
- QTP - Objects Classifications
- QTP - Overview
- QTP - Pass ByRef and Pass ByVal
- QTP - PDFs
- QTP - Recording Modes
- QTP - Recovery Scenario Manager
- QTP - Regular Expressions - Complete Reference
- QTP - Regular Expressions - Scripts
- QTP - Reporter Utility
- QTP - Reporter Utility - Scripts
- QTP - SetTOProperty Script Demo
- QTP - Synchronization
- QTP - Synchronization - Script Demo
- QTP - Synchronization Methods
- QTP - Synchronization Script
- QTP - Test / Action Template
- QTP - VBScript - Array Sorting
- QTP - VBScript - Dictionary Object
- QTP - VBScript and Data Types
- QTP - VBScript Functions - One Reference
- QTP - Videos
- QTP - Ways to synchronize
- QTP – Descriptive Programing – Any Web App - Working with Web Check Boxes
- QTP – Descriptive Programing – Examples
- QTP – Outlook Application
- QTP – Regular Expressions
- QTP – Web Tables
- QTP 10 Supports Windows 7 and IE8
- QTP Basics
- QTP Boks
- QTP Books
- QTP Complete Learning Table
- QTP Easy Learning
- QTP for Beginners
- QTP Info
- QTP Introduction
- QTP Learning
- QTP Learning MadeEasy. QTP QTP Learning Let's Learn QTP QTP Easy Learning QTP Guide QTP Book QTP Learning PDF QTP - Fundamentals QTP - Advanced QTP - Topic by Topic QTP Lessons GAReddy - QTP
- QTP Learning Materials
- QTP Simple
- QTP Videos
- Requirements Flow
- Roles and Responsibilities of Testers
- Software Testing - Core Testing Definitions
- Software Testing - FAQs
- Software Testing - Testing Methodologies
- Software Testing - Testing Process
- Software Testing Glossary : QA - Testing All in One
- Software Testing Process
- Stress Testing Requirements
- Stress testings
- Stress Testings - Why
- Test Case - Test Case Design Techniques
- Test Case - What is Test Case
- Test Case - What should a Test Case contain
- Test Case Designing Techniques
- Testing - Daily Status Report
- Testing - Defect - Defect Documenting
- Testing - Defect - Defect Life Cycle
- Testing - Defect - What is a Bug (Defect)
- Testing - Defect – Metrics
- Testing - Defect – Priority Levels
- Testing - Defect – Severity Levels
- Testing - Important FAQs
- Testing - Load Testing - Performance Testing - Stress Testing
- Testing - Requirements Flow
- Testing - UAT - Alpha Testing and Beta Testing
- Testing - Verification and Validation
- Testing Definitions
- Testing Methodologies
- Testing Terminologies
- VB Script Features
- What is Testing?
- When does the Testing begin?
- When does the Testing end?
- Why do we need Testing?
- Why does software have bugs?