You are on page 1of 11

Object identification properties can be used in the object repository description, in programmatic

descriptions, in checkpoint and output value steps, and as argument values for the GetTOProperty
Property Name Description
abs_x The object's absolute x-coordinate (left relative to the screen (in pixels!
abs_y The object's absolute y-coordinate (top relative to the screen (in pixels!
border The "idth of the object's border!
class The object's class (class#ame property!
cols The number of columns in the table!
height The object's height (in pixels!
html id The object's $T%& identifier!
html tag The object's $T%& tag!
index The ordinal identifier that 'uickTest assigns to the object to indicate the order in "hich
the object appears in the code relative to other objects "ith an other"ise identical
description! This property cannot be used "ith GetROProperty!
innerhtml The $T%& code contained bet"een the object's start and end tags!
innertext The text contained bet"een the object's start and end tags!
location The ordinal identifier that 'uickTest assigns to the object to indicate "here the object
appears "ithin the "indo", frame, or dialog box! (alues are assigned from top to
bottom, and left to right! This property cannot be used "ith GetROProperty!
name The object's name!
outerhtml The object's $T%& code and its content! )upported in *nternet +xplorer only!
outertext The object's text! )upported in *nternet +xplorer only!
,epository#ame The name of the object as it is stored in the object repository!
Note: This property is relevant only "hen "orking in the )iebel Test -utomation
environment "ith the )iebel -dd-in loaded!
ro"s The number of ro"s in the table!
)iebelObjType The type of object that the $T%& element represents!
Note: This property is relevant only "hen "orking in the )iebel Test -utomation
environment "ith the )iebel -dd-in loaded!
text The text associated "ith the object!
.*#ame The name of the object as it appears in the user interface!
Note: This property is relevant only "hen "orking in the )iebel Test -utomation
environment "ith the )iebel -dd-in loaded!
visible *ndicates "hether the object is visible!
Note: Only True and False are valid values for this property! 1 and 0 are not valid
values!
"idth The object's "idth (in pixels!
x The object's x-coordinate (left relative to the frame (in pixels!
y The object's y-coordinate (top relative to the frame (in pixels!
and GetROProperty methods! The /ebTable test object supports the identification properties listed in
the table belo"! 0or a list of the run-time object's native properties and methods see1
Description
- table containing a variable number of ro"s and columns!
Operations
The sections belo" list the built-in methods and properties that you can use as operations for the
/ebTable object!
Note: 2ou can also vie" a list and descriptions of the /ebTable identification properties, for use in object
repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument
values for the 3etTO4roperty and 3et,O4roperty methods!
Methods
5apture6itmap )aves a screen capture of the object as a !png or !bmp image,
depending on the specified file extension!
5heck 5hecks "hether the actual value of an item matches the expected
value!
5heck4roperty 5hecks "hether the specified object property achieves the
specified value "ithin the specified timeout!
5hild*tem ,eturns a test object from the cell by type and index!
5hild*tem5ount ,eturns the number of objects of a specific type in the specified
cell!
5hildObjects ,eturns the collection of child objects contained "ithin the object!
5lick 5licks the object! 'uickTest records clicks "ith the right mouse
button only if the /eb objects and 'uickTest 4rofessional are both
configured correctly! 0or more information, refer to the 7Testing
/eb Objects7 chapter in the QuickTest Professional Add-ins Guide
$elp!
5olumn5ount ,eturns the number of columns in the table!
8rag 4erforms the 'drag' part of a drag and drop operation!
8rop 4erforms the 'drop' part of a drag and drop operation!
0ire+vent Triggers an event!
3et5ell8ata ,eturns the text contained in the specified cell!
3et,O4roperty ,eturns the current value of the test object property from the
object in the application!
3et,o"/ith5ellText ,eturns the number of the first ro" found that contains a cell "ith
the specified text!
3etTO4roperties ,eturns the collection of properties and values used to identify the
object!
3etTO4roperty ,eturns the value of the specified property from the test object
description!
Output ,etrieves the current value of an item and stores it in a specified
location!
,efreshObject *nstructs 'uickTest to re-identify the object in the application the
next time a step refers to this object!
,o"5ount ,eturns the number of ro"s in the table!
)etTO4roperty )ets the value of the specified property in the test object
description!
)ubmit )ubmits a form!
To)tring ,eturns a string that represents the current test object!
/ait4roperty /aits until the specified object property achieves the specified
value or exceeds the specified timeout before continuing to the
next step!
Description
5hecks "hether the object currently exists in the open application!
Syntax
object.Exist(9TimeOut:)
Syntax Details
r!"ment Description
object - test object of type /ebTable!
TimeOut Optional! -n .&ong object!
The length of time (in seconds to search for the object before
returning a True or 0alse value!
*f a timeout value is specified, 'uickTest "aits until it finds
the object or until the timeout is reached!
*f the value # is specified, the property returns the True or
0alse value immediately!
*f no value is specified, the value specified in the Test
)ettings dialog box for the O$%ect Synchroni&ation Timeo"t is
used for tests! 0or business components, the pre-defined value of
;< seconds is used!
0or more information on the O$%ect Synchroni&ation Timeo"t
+xample'hec( )hether a *ro+ser )indo+ Exists
Sub Exist_Example()
'The following example uses the Exist method to
determine the
'existence of the "Mercury Tours" browser !f the
ob"ect exists#
'a message box appears confirming its appearance
!f $rowser("Mercury Tours")Exist Then
Msg$ox "The browser exists"
End !f
End Sub
''6ro"ser(7%*#8' ,-#0O,8 6-#=7!4age(7%*#8' ,-#0O,8 6-#=7!/eb+dit(7txtu*d7!)et
7%ercury7
''>?6ro"ser(7%*#8' ,-#0O,8 6-#=7!4age(7%*#8' ,-#0O,8
6-#=7!/eb+dit(7txtu*d7!5heck4roperty (7value7, 7%ercury7
''msgbox >
'
''The follo"ing example uses the 5heck4roperty method to verify the
''number of items in a /eb&ist! #ote that if the original count
''is not e@ual to AB, an error message is displayed in the Test ,esults!
'
'6ro"ser(70ill-Out 0orm +xample7!4age(70ill-Out 0orm +xample7!/eb&ist(7"hat-to-
do7!5heck4roperty 7items count7, AB, Time&imitation
'*tem_5ount ? 6ro"ser(70ill-Out 0orm +xample7!4age(70ill-Out 0orm
+xample7!/eb&ist(7"hat-to-do7!3et,O4roperty(7items count7
'*f *tem_5ount ? AB Then
' ',emove one item from the list
' 6ro"ser(70ill-Out 0orm +xample7!4age(70ill-Out 0orm +xample7!/eb6utton(7,emove
*tem 0rom &ist7!5lick
' '5heck if the item "as removed from the list
' 6ro"ser(70ill-Out 0orm +xample7!4age(70ill-Out 0orm +xample7!/eb&ist(7"hat-to-
do7!5heck4roperty 7items count7, AC, Time&imitation
'+lse
' ,eporter!,eport+vent mic0ail, 7#umber Of &ist *tems7, 7The item count in the list should
be AB, not 7 D *tem_5ount D 7!7
'+nd *f
'5hild*tem_+xample(
'The follo"ing example uses the 5hild*tem method to set the second
'edit box from the 0irst#ame table to +xample!
)et /eb+ditObj ? 6ro"ser(7,egister1 %ercury Tours7!4age(76ook a 0light1
%ercury7!/ebTable(7)ummary7!5hild*tem(E, ;, 7/eb+dit7, <
/eb+ditObj!)et 7+xample7
'5hildObjects_+xample(
'The follo"ing example uses the 5hildObjects method to find all the
'list objects on a /eb page, and then to select an item in each list!
)et o8esc ? 8escription!5reate(
o8esc(7micclass7!(alue ? 7/eb&ist7
)et &ists ? 6ro"ser(7%ercury *nteractive7!4age(7%ercury *nteractive7!5hildObjects(o8esc
#umberOf&ists ? &ists!5ount(
0or i ? < To #umberOf&ists - A
&ists(i!)elect i F A
#ext
5hildObjects_+xample(
'The follo"ing example retrieves the collection of
'/eb+dit objects in order to find a specific
'/eb+dit object in a page and set a value for it!
8im +ditTo)earch, (alueTo)et, #umberOf+dits
'This is the value of the 'name' property for the /eb+dit object "e "ant to find!
+ditTo)earch ? 7credit_card_number7
(alueTo)et ? 7GBBEHEIJJG;G<BJE7
'5reate a description object to help retrieve all /eb+dit objects in a specific page!
)et o8esc ? 8escription!5reate(
o8esc(7micclass7!(alue ? 7/eb+dit7
o8esc(7name7!(alue ? 7credit_card_number7
',etrieve all /eb+dit objects in this page
)et +dit5ollection ? 6ro"ser(76ook a 0light1 %ercury7!4age(76ook a 0light1
%ercury7!5hildObjects(o8esc
#umberOf+dits ? +dit5ollection!5ount
')earch for a specific /eb+dit object and set its value
0or i ? < To #umberOf+dits - A
*f +dit5ollection(i!3et,O4roperty(7name7 ? +ditTo)earch Then
+dit5ollection(i!)et (alueTo)et
+nd *f
#ext
5hildObjects_+xample(
'The follo"ing example retrieves the collection of
'/eb+dit objects that contain credit card numbers
'and inserts them in an +xcel file!
8im #umberOf+dits
'5reate a 8escription object to help retrieve all
'/eb+dit objects in a specific page!
)et o8esc ? 8escription!5reate(
o8esc(7micclass7!(alue ? 7/eb+dit7
',etrieve all /eb+dit objects from this page!
)et +dit5ollection ? 6ro"ser(76ook a 0light1 %ercury7!4age(76ook a 0light1
%ercury7!5hildObjects(o8esc
#umberOf+dits ? +dit5ollection!5ount
'.se the 3et,O4roperty to retrieve the 7text7 property
'("hich in this case represents a credit card number,
'and insert all retrieved credit card numbers in an +xcel file!
0or i ? < To #umberOf+dits - A
5urrent5redit#umber ? +dit5ollection(i!3et,O4roperty(7text7
/riteTo5redit5ard#umber+xcel0ile (5urrent5redit#umber
#ext
5lick_+xample(
'The follo"ing example uses the 5lick method on a form!
6ro"ser(7#e" 4age7!4age(7#e" 4age7!/eb+lement(7html tag1?0orm7!5lick
5olumn5ount_+xample(
'The follo"ing example uses the 5olumn5ount method to determine the
'number of columns in the first ro" of the Outbound0lights table!
#um5olumns ? 6ro"ser(7%ercury Tours7!4age(7)earch
,esults7!/ebTable(7Outbound0lights7!5olumn5ount(A
%sg6ox 7The number of columns in the ro" is 7 D #um5olumns
8rag_and_8rop_+xample(
'The follo"ing example uses the 8rag and 8rop methods to drag a copy of an item from the
*nbox pane of
'%icrosoft Outlook /eb -ccess and drop it in the Kunk folder! Then it uses the 8rag and 8rop
methods again
'to move the item from the Kunk folder to the 8eleted *tems folder!
6ro"ser(7%icrosoft Outlook /eb7!4age(7%icrosoft Outlook
/eb_;7!0rame(7vie"er7!/eb+lement(7%y+mail7!8rag , mic#o5oordinate, mic#o5oordinate,
mic5trl
6ro"ser(7%icrosoft Outlook /eb7!4age(7%icrosoft Outlook
/eb_;7!0rame(7navbar7!&ink(7Kunk +-mail7!8rop
6ro"ser(7%icrosoft Outlook /eb7!4age(7%icrosoft Outlook
/eb_;7!0rame(7vie"er7!/eb+lement(7%y+mail7!8rag
6ro"ser(7%icrosoft Outlook /eb7!4age(7%icrosoft Outlook
/eb_;7!0rame(7navbar7!&ink(78eleted *tems7!8rop
0ire+vent_+xample(
'The follo"ing example uses the 0ire+vent method to trigger
'the onpropertychange event on a form!
6ro"ser(7#e" 4age7!4age(7#e" 4age7!/eb+lement(7html tag1?0orm7!0ire+vent
7onpropertychange7
3et5ell8ata_+xample(
'The follo"ing example uses the 3et5ell8ata method to display the
'contents of the cell located in cell A, column A in a message box!
)et Text ? 6ro"ser(7%ercury Tours7!4age(7)earch
,esults7!/ebTable(7Outbound0light7!3et5ell8ata(A, A
%sg6ox 7text contains7 D Text
3et5ell8ata_3et,o"/ith5ellText_+xample(
'The follo"ing example retrieves the names of all employees that live in
'the same city as Kohn )mith so that he can arrange rides home "ith them!
'0irst, the example finds the table ro" containing
'7Kohn )mith7! Then it checks the value of the 5ity5olumnn cell to determine
'the city in "hich Kohn lives! *t searches the table cells to find all other
'employees that live in that city! 0inally it uses the 3et5ell8ata method to
'return those employees names and, using a function, generates a list
'containing those names!
5ity5olumn ? C
#ame5olumn ? ;
'3et the ro" number for employee 'Kohn )mith'
,o"#umber ?
6ro"ser(75orporate+mployees7!4age(75orporate+mployees7!/ebTable(7+mployeesTable7!3
et,o"/ith5ellText(7Kohn )mith7
)et -ccommodations5ity ?
6ro"ser(75orporate+mployees7!4age(75orporate+mployees7!/ebTable(7+mployeesTable7!5
hild*tem(,o"#umber, 5ity5olumn, 7/eb+dit7, <
Table,o"s ?
6ro"ser(75orporate+mployees7!4age(75orporate+mployees7!/ebTable(7+mployeesTable7!,
o"5ount
')earch for all employees that live in the same city as 'Kohn )mith' and add them to his ride
home list
0or i ? A To Table,o"s
)et 5urrent5ity ?
6ro"ser(75orporate+mployees7!4age(75orporate+mployees7!/ebTable(7+mployeesTable7!5
hild*tem(i, 5ity5olumn, 7/eb+dit7, <
*f 5urrent5ity!3et,O4roperty(7value7 ? -ccommodations5ity!3et,O4roperty(7value7
Then
+mployee#ame ?
6ro"ser(75orporate+mployees7!4age(75orporate+mployees7!/ebTable(7+mployeesTable7!3
et5ell8ata(i, #ame5olumn
-ddToKohn)mith,ide$ome&ist (+mployee#ame
+nd *f
#ext
3et,o"/ith5ellText_+xample(
'The follo"ing example uses the 3et,o"/ith5ellText method to
'find the ro" in the 7Outbound0lights7 table that contains the
'text 74rice7 and then find the cell in that ro" that contains
'a link and click it!
ro" ? 6ro"ser(7%ercury Tours7!4age(7)earch
,esults7!/ebTable(7Outbound0lights7!3et,o"/ith5ellText(74rice7, ;, ;
)et &ink ? 6ro"ser(7%ercury Tours7!4age(7)earch
,esults7!/ebTable(7Outbound0lights7!5hild*tem(ro", ;, 7&ink7, <
&ink!5lick
'The follo"ing example checks "hether the 7url7 property exists, and, if not,
'generates an error! The example calls the $as4roperty.,&(&inkObj function
'(defined belo" as commented text!
has_url_prop ? $as4roperty.,&(6ro"ser(76ro"ser7!4age(74age7!&ink(75ontinue7
*f has_url_prop ? 0alse Then
+rr!,aise HA
+nd *f
'
'The follo"ing function, used in the above example, uses the 3etTO4roperties method
'to retrieve the list of properties and values for the &ink test object in order
'to check if a &ink test object has the 7url7 property!
'
'4ublic 0unction $as4roperty.,&(&inkObj
'
'4ropertyTo)earch ? 7url7
'4roperty+xist*nTO ? 0alse
')et 4roperty5ollection ? &inkObj!3etTO4roperties
'
'0or i ? < To 4roperty5ollection!5ount - A
'
' *f 4roperty5ollection(i!#ame ? 7url7 Then
' 4roperty+xist*nTO ? True
' +xit 0or
' +nd *f
'
'#ext
'
'$as4roperty.,& ? 4roperty+xist*nTO
'
'+nd 0unction
3etTO4roperties_+xample(
'The follo"ing example uses the 3etTO4roperties method to retrieve
'the list of properties and values used to identify the 0irst#ame
'/ebTable!
)et Table8esc ? 6ro"ser(7%ercury Tours7!4age(7%ethod of
4ayment7!/ebTable(70irst#ame7!3etTO4roperties
3etTO4roperties_+xample(
'The follo"ing example uses the 3etTO4roperties method to return a
'4roperty collection containing the test object description
'(properties and values for the -ll kind of &ink object!
'*t then displays the property name and value of each property in
'the returned collection!
)et &inkObject ? 6ro"ser(7*ndex7!4age(7index7!&ink(7-ll kind of7
)et 4rops ? &inkObject!3etTO4roperties
4rops5ount ? 4rops!5ount
0or i ? < To 4rops5ount - A
4rop#ame ? 4rops(i!#ame
4rop(alue ? 4rops(i!(alue
%sg6ox 4rop#ame D 7 ? 7 D 4rop(alue
#ext
3etTO4roperty_+xample(
'The follo"ing example uses the 3etTO4roperty method to retrieve
'the value of the /ebTable's $tmlTag property from the Object
',epository!
TableTag ? 6ro"ser(7%ercury Tours7!4age(7%ethod of
4ayment7!/ebTable(70irst#ame7!3etTO4roperty(7$tmlTag7
' TableTag contains 7T-6&+7
3etTO4roperty_+xample(
'The follo"ing example uses the 3etTO4roperty method to retrieve the number of items from
a /eb&ist
'test object containing a list of student names! Then it generates an array according to the list
si>e,
'inserting the each of the student's names into the array! 0inally, it retrieves each student's
name and
'uses a function to send grades to the students!
&ist)i>e ?
6ro"ser(7&istOf)tudent#ames7!4age(7&istOf)tudent#ames7!/eb&ist(7&istOf)tudent#ames7
!3etTO4roperty(7items count7
8im #ames-rray(
'8ynamically allocate an array according to the list si>e
,e8im #ames-rray(&ist)i>e - A
0or i ? A To &ist)i>e
#ames-rray(i - A ?
6ro"ser(7&istOf)tudent#ames7!4age(7&istOf)tudent#ames7!/eb&ist(7&istOf)tudent#ames7
!3et*tem(i
#ext
'The follo"ing function uses the array of student names in order to send grades to the
students!
)end3rades6y)tudent#ame (#ame-rray
Output_+xample(
'The follo"ing example uses the Output method to output data from
'a link text item!
6ro"ser(7%ercury Technologies7!4age(7%ercury Technologies7!&ink(7Kobs7!Output
5heck4oint(7Kobs7
,efreshObject_+xample(
'*n the follo"ing example, the variable %y&ink represents a '5ontact $4' link object!
'6ecause the link object exists on every page of the $4 /eb site, you can perform operations
on
'this object from different locations in the test! *n this example, the second time an operation
'is performed on the '5ontact $4' link, the operation is performed from a different /eb page
'(and thus on a different object, even though its test object description still matches
'the one in the object repository!
'Therefore, a ,efreshObject statement is performed on the %y&ink variable to ensure that
'uickTest can
'successfully identify the object before performing the second 5lick statement!
)et %y&ink ? 6ro"ser(7$4 .nited )tates - 5omputers,7!4age(7$4 .nited )tates -
5omputers,7!&ink(75ontact $47
%y&ink!5lick
6ro"ser(7$4 .nited )tates - 5omputers,7!)ync
%y&ink!,efreshObject
,o"5ount_+xample(
'The follo"ing example uses the ,o"5ount method to determine the
'number of ro"s in the Outbound 0lights table!
#um,o"s ? 6ro"ser(7%ercury Tours7!4age(7)earch
,esults7!/ebTable(7Outbound0lights7!,o"5ount
' #um,o"s contains B
)etTO4roperty_+xample(
'The follo"ing example uses the )etTO4roperty method to set the
'style of a image's /eb+lement in run-time!
6ro"ser(7#e" 4age7!4age(7#e" 4age7!/eb+lement(7just text7!)etTO4roperty 7)tyle7,
7'color1blue'7
)etTO4roperty_+xample(
'The follo"ing example uses the )etTO4roperty method to set the
'html id of the /eb0ile object!
6ro"ser(70ill-Out-0orm7!4age(70ill-Out-0orm7!/eb0ile(7name-of-files7!)etTO4roperty 7html
id7, C
)etTO4roperty_+xample(
'The follo"ing example uses the )etTO4roperty to add additional
'identification properties for 'uickTest to use "hen identifying a test object
'"hose existing test object description is not enough to identify it!
*f 6ro"ser(7Table "ith objects7!4age(7Table "ith objects7!/eb+dit(7/eb+dit7!+xist Then
6ro"ser(7Table "ith objects7!4age(7Table "ith objects7!/eb+dit(7/eb+dit7!)et 7)unday7
+lse
)et +ditObject ? 6ro"ser(7Table "ith objects7!4age(7Table "ith
objects7!/eb+dit(7/eb+dit7
+ditObject!)etTO4roperty 7html tag7, 7T+LT-,+-7
+ditObject!)etTO4roperty 7type7, 7textarea7
+ditObject!)et 7)unday7
+nd *f
To)tring_+xample(
'The follo"ing example retrieves a list of links from the
'7)imple /eb +xample7 page, creates the 0ile)ystemObject,
'and uses the To)tring method to "rite the test object (link names (for example,
'7banner7 and 7contents7 and test object type (for example, 70rame7
'to c1M&inks!txt!
8im fso, ,esult0ile, o8esc
'3et a collection of all &inks in the 7)imple /eb +xample7 page
)et o8esc ? 8escription!5reate
o8esc(75lass #ame7!(alue ? 7&ink7
)et o&ink5ollection ? 6ro"ser(7)imple L%& +xample from7!4age(7)imple /eb
+xample7!5hildObjects(o8esc
'5reate the 0ile)ystemObject
)et fso ? 5reateObject(7)cripting!0ile)ystemObject7
)et ,esult0ile ? fso!OpenText0ile(7c1M&inks!txt7, ;, True ' ; ? Open file for "riting
'/rite to the file
0or i ? < To o&ink5ollection!5ount - A
,esult0ile!/rite o&ink5ollection!*tem(i!To)tring D vb#e"&ine
#ext
,esult0ile!5lose
To)tring_+xample(
'The follo"ing example uses the To)tring method to insert
'the test object's name and generic type in the Test ,esults!
Object)tring ? 6ro"ser(70ill-Out 0orm +xample7!4age(70ill-Out 0orm
+xample7!/eb&ist(7"ho-to-do-it-"ith7!To)tring
'.se the To)tring to return value to enhance the reporter!
,eporter!,eport+vent mic8one, 7/e are selecting the fourth item in the 7 D Object)tring, 77
6ro"ser(70ill-Out 0orm +xample7!4age(70ill-Out 0orm +xample7!/eb&ist(7"ho-to-do-it-
"ith7!)elect 7NC7
/ait4roperty_+xampleA(
'The follo"ing example uses the /ait4roperty method to "ait for the
'-ll kind of link's ready)tate to be complete or for
'C seconds (C<<< milliseconds to pass, "hichever comes first!
'*f the link achieves this value before C<<< milliseconds pass,
''uickTest clicks the link!
*f 6ro"ser(7index7!4age(7index7!&ink(7-ll kind of7!/ait4roperty(7attributeOready)tate7,
7complete7, C<<< Then
6ro"ser(7index7!4age(7index7!&ink(7-ll kind of7!5lick
+nd *f
/ait4roperty_+xample;(
'The follo"ing example uses the /ait4roperty method to "ait for the
'-ccount edit box to be enabled before setting its value to A;G!
'*f it is still disabled after the test's
'Object )ynchroni>ation Timeout time has been exceeded, it "ill not
'perform the )et method!
*f 6ro"ser(7index7!4age(7index7!/eb+dit(7-ccount7!/ait4roperty(7disabled7, < Then
6ro"ser(7index7!4age(7index7!/eb+dit(7-ccount7!)et (7A;G7
+nd *f
+xist_+xample(
'The follo"ing example uses the +xist method to determine the
'existence of the 7%ercury Tours7 bro"ser! *f the object exists,
'a message box appears confirming its appearance!
*f 6ro"ser(7%ercury Tours7!+xist Then
%sg6ox 7The bro"ser exists!7
+nd *f
Object_+xample(
'The follo"ing example uses the !Object property to activate an
'edit box's native focus method1
)et %y/eb+dit ? 6ro"ser(7%ercury Tours7!4age(7%ercury
Tours7!/eb+dit(7username7!Object
%y/eb+dit!focus

You might also like