Micro Focus QTP (UFT) Forums
How can i identify objects "By Name" in QTP 9.2? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How can i identify objects "By Name" in QTP 9.2? (/Thread-How-can-i-identify-objects-By-Name-in-QTP-9-2)



How can i identify objects "By Name" in QTP 9.2? - pointguard888 - 10-22-2008

Hey All,

Actually this is my first time to deal with this forum so excuse me if i'm asking some old or preliminary questions, and i'm new to using QTP 9.2 with .NET extensibility trying to automate the testing of an application that's basicly developed using .NET 2003.

I have played around with QTP's recorder and it's seems pretty strong, but unfortunately i ran into some problems trying to identify objects in the application.

Basicly the recorder captures many of the windows within the application but the children objects within those windows are only identified "By Location" (i.e. by the x,y coordinates of the objects with respect to the window)...

So my question is how can i identify those children object within the windows of the application "by name" not by "Location" ????

As i don't want to base my automation on the x,y loactions of objects. I need to capture those objects by name to be able to manipulate them with more flexibility later on.

Here is an example of the script generated by QTP recorder upon running on the AUT

Code:
Window("Application").Activate
Window("Application").WinObject("treeListViewControl").Click 106,57
Window("Application").WinObject("treeListViewControl").Click 126,102
Window("Application").WinObject("treeListViewControl").Click 142,116
Window("Application").WinObject("treeListViewControl").Click 142,135
What i need to achieve..something like

Code:
Window("Application").Activate
Window("Application").WinObject("treeListViewControl").TreeItem("Item 1").click
Window("Application").WinObject("treeListViewControl").TreeItem("Item 2").click
Window("Application").WinObject("treeListViewControl").TreeItem("Item 3").click
Window("Application").WinObject("treeListViewControl").TreeItem("Item 4").click

Reagrds,
Karim.


RE: How can i identify objects "By Name" in QTP 9.2? - anemuday - 10-22-2008

Hi,

From your recorded script, we can know that, QTP is unable to identify the objects in your application(because of WinObject statements).

Install proper add-ins and try to record your operations in the application.

Regards,
Uday.