Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Qtp Tutorials

Qtp Tutorials



|Views: 5,714 |Likes:
Published by umadasdey

More info:

Published by: umadasdey on Jan 13, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC or read online from Scribd
See more
See less


1.Activate: Activates the current Dialog Box.Syntax: object.Activate [BUTTON]Example:Sub Activate_Example()‘The following example uses the Activate method to activate the‘Internet Options dialog box.Browser(”Mercury Tours”).Dialog(”Internet Options”).ActivateEnd Sub2. CaptureBitmap: Saves the screen capture of the object as a .png or .bmp image using the specified file name.Syntax: object.CaptureBitmap FullFileName, [OverrideExisting]Example:Sub CaptureBitmap_Example1()‘The following example uses the CaptureBitmap method to capture a’screen shot of the Internet Options dialog box. The file is‘automatically saved to a different folder (the test run results‘folder) in each run.Browser(”Mercury Tours”).Dialog(”Internet Options”).CaptureBitmap “internet_options.bmp”End Sub3. ChildObjects: Returns the collection of child objects contained within the object.Syntax: object.ChildObjects (pDescription)Example:‘The following example uses the ChildObjects method to retrieve a’set of child objects matching the description listed in the function‘call and uses the method to display a message indicating how many‘objects are found with the specified description: none, one (unique),‘or several (not unique).Public Function CheckObjectDesription(parent, descr)Dim oDesc‘ Create description objectSet oDesc = Description.Create()arProps = Split(descr, “,”)For i = 0 To UBound(arProps)arProp = Split(arProps(i), “:=”)If UBound(arProp) = 1 ThenPropName = Trim(arProp(0))PropValue = arProp(1)oDesc(PropName).Value = PropValueEnd IfNext‘ Get all child objects with the given descriptionSet children = parent.ChildObjects(oDesc)If children.Count = 1 ThenCheckObjectDesription = “Object Unique”ElseIf children.Count = 0 ThenCheckObjectDesription = “Object Not Found”ElseCheckObjectDesription = “Object Not Unique”End IfEnd Function4. Click: Clicks on a object.Syntax: object.Click [X], [Y], [BUTTON]Example:Sub Click_Example()‘The following example uses the Click method to click a right mouse‘button at coordinates 47, 131 on the Internet Options dialog box.
Browser(”Mercury Tours”).Dialog(”Internet Options”).Click 47, 131, 1End Sub5. Close: Closes the Dialog Box.Syntax: object.CloseExample:Sub Close_Example()‘The following example uses the Close method to close the Internet‘Options dialog box.Browser(”Mercury Tours”).Dialog(”Internet Options”).CloseEnd Sub6. DblClick: Double clicks on a object.Syntax: object.DblClick X, Y, [BUTTON]Example:Sub DblClick_Example()‘The following example uses the DblClick method to double-click a right‘mouse button at coordinates 73, 120 on the SysListView32 object.Window(”Exploring”).WinListView(”SysListView32″).DblClick 73, 120, 1End Sub7. Drag: Performs the ‘drag’ part of a drag and drop operation.Syntax: object.Drag X, Y, [BUTTON]Example:Sub Drag_Example1()‘The following example uses the Drag and Drop methods to drag the object from‘coordinates 10, 20 within the Test window and drop the object at‘coordinates 30, 40 within the same window.Window(”Test”).Drag 10, 20Window(”Test”).Drop 30, 40End Sub8. Drop: Performs the ‘drop’ part of a drag and drop operation.Syntax: object.Drop X, Y, [BUTTON]Example:Sub Drop_Example1()‘The following example uses the Drag and Drop methods to drag the object from‘coordinates 10, 20 within the Test window and drop the object at‘coordinates 30, 40 within the same window.Window(”Test”).Drag 10, 20Window(”Test”).Drop 30, 40End Sub9. Exist: Checks that an object exists.Syntax: object.Exist([TimeOut])Example:Sub Exist_Example()‘The following example uses the Exist method to determine the existence‘of the Internet Options dialog box. If the dialog box exists a‘message box appears confirming its appearance.If Browser(”Mercury Tours”).Dialog(”Internet Options”).Exist ThenMsgBox (”The object exists.”)End IfEnd Sub10. GetRoProperty: Returns the current value of the test object property from the object in the application.Syntax: object.GetROProperty (Property, [PropData])Example:
Sub GetROProperty_Example()‘The following example uses the GetROProperty method to retrieve the‘x coordinate of the Test window.x = Window(”Test”).GetROProperty(”x”)y = Window(”Test”).GetROProperty(”y”)End Sub11. GetTextLocation: Checks whether the specified text string is contained in the specified window area.Syntax: object.GetTextLocation (TextToFind, Left, Top, Right, Bottom, [MatchWholeWordOnly])Example:Sub GetTextLocation_Example()‘The following example uses the GetTextLocation method to retrieve‘all of the text within the object.l = -1t = -1r = -1b = -1result = Dialog(”Dialog”).WinObject(”Date”).GetTextLocation(”2002″, l, t, r, b)If result ThenMsgBox “Text found. Coordinates:” & l & “,” & t & “,” & r & “,” & bEnd IfEnd Sub12. GetToProperties: Returns the collection of properties and values used to identify the object.Syntax: object.GetTOPropertiesExample:Sub GetTOProperties_Example1()‘The following example uses the GetTOProperties method to retrieve the‘list of properties and values used to identify the Internet Options‘dialog box.IEOptsDialog = Browser(”Mercury Tours”).Dialog(”Internet Options”).GetTOProperties()End Sub13. GetToProperty: Returns the value of a specified property from the test object description.Syntax: object.GetTOProperty (Property)Example:Sub GetTOProperty_Example()‘The following example uses the GetTOProperty method to retrieve the‘RegExpWndClass property from the Object Repository.Dim ObjectNameRegExpWndClass = Window(”Test”).GetTOProperty(”RegExpWndClass”)End Sub14. GetVisibleText: Returns the text from specified area.Syntax: object.GetVisibleText ([Left], [Top], [Right], [Bottom])Example:Sub GetVisibleText_Example1()‘The following example uses the GetVisibleText method to retrieve the‘text from the Telnet window. If the returned string contains the “login:”’sub-string, the Type method is used to type the guest string in the‘window.TelnetText = Window(”Telnet”).GetVisibleTextIf InStr(1, TelnetText, “login:”, 1) > 0 ThenWindow(”Telnet”).Type “guest”End IfEnd Sub

Activity (8)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
johnsonkk125 liked this
reddy00004 liked this
ovidiu_amigo liked this
Aditya Saxena liked this
kmdasari liked this
angel_babe_21 liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->