Highlight an object or window using QTP

To highlight an object or window manually or programmatically (from within the script)

Manually

Object Repository window. Available also in the Object Repository Manager for shared object repositories:
1. Open the Object Repository

2. Select desired object to highlight

3. Go to "View" menu

4. Select "Highlight in application" option

5. See results:
◦ Succesful: Blinking gray rectangle surrounding the object

◦ Failed: A pop-up window with an error or warning.

Object Spy. Available in QuickTest Professional 11.00, Unified Functional Testing 11.5 and later):
1. Open the Object Spy dialog

2. Click on the spy button

3. Click/Select desired object or child of desired object

4. Select desired object from the Hierarchical tree pane

5. Click the "Highlight in application" option, next to "Spy" button

6. See results (Exact same as when using similar option from Object Repository section above)

Programmatically

Call/Invoke/Use the hidden/undocumented programmatic Highlight method.

Object(description).highlight

Where "Object" is a Test Object class.

description – The logical name or a descriptive programming description of the object or window to be highlighted.

Example:

Browser("Netscape.com").highlight
wait 1
Browser("Netscape.com").Page("Netscape.com").Link("Breaking News:").highlight
wait 1
Browser("Netscape.com").Page("Netscape.com").Image("Get Quote").highlight

‘ or

Window("Notepad").WinEditor("Edit").highlight
wait 1
Window("Notepad").highlight
wait 1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s