Micro Focus QTP (UFT) Forums
Identifying of an object on window among the multiple objects with similar properties - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Identifying of an object on window among the multiple objects with similar properties (/Thread-Identifying-of-an-object-on-window-among-the-multiple-objects-with-similar-properties)



Identifying of an object on window among the multiple objects with similar properties - venkatbatchu - 08-11-2009

Hi All,
Please view the attached screen shot
How to identify an object while executing the script?

Thanks,
Venkat.Batchu


RE: Identifying of an object on window among the multiple objects with similar proper - basanth27 - 08-11-2009

Try this,

Code:
Browser().page().frame().image("html tag:=IMG","index:=0").Click

This will click on the first list button. Vary the index numeric to click on the rest.


RE: Identifying of an object on window among the multiple objects with similar proper - venkatbatchu - 08-11-2009

How to view the Index of an object in a window (Note: I am familiar that we could see the index from test object details in object repository)
Does we have any option other than this because to view this index from object repository we need to add objects to object repository..

Thanks,
Venkat.Batchu


RE: Identifying of an object on window among the multiple objects with similar proper - basanth27 - 08-11-2009

Descriptive programming should help !


RE: Identifying of an object on window among the multiple objects with similar properties - sreekanth chilam - 08-11-2009

HI Venkat ,

I would suggest you to try with the below way.

Step1: As per your Spy screenshot's heirarchy, ListButton(Image) comes under "WebTable" object. So identify under which WebTable its falling, then add that WebTable.

Step2: Retrieve the rowcount of the above WebTable

Step3: Use "For" Loop through the above Rowcount & use "ChildItem" Method for returning the Objects "Image"(ListButton) & then click them

I am sure that the above approach would work fine.

@Basanth : If the Image(ListButtons) are under the WebTable , then no need of your above approach. Isn't it ?


RE:Identifying of an object on window among themultipleobjects with similarproperties - rameshrise3 - 08-12-2009

Hi,
Use Descriptive programming and use HWND as the property so that it identifies all the listButtons uniquely.

Code:
Browser("").Page("").Frame("").Image("Name:=List", "Hwnd:=------")



RE: Identifying of an object on window among the multiple objects with similar proper - basanth27 - 08-12-2009

Srikanth -
Yes, your approach will also be correct. However, you should also note that all the webtables will not be designed with the childitems in them. Either ways, there is never a issue to try and check out. I replied to Venkat in that manner because his question's intrest just was to click on the list button image.

Ramesh -
Please verify before you write. There is no name property which defines itself to "List" from the screenshot supplied. Morever hwnd is not a image property. Morever, you cannot use hwnd to always identify objects uniquely because they will correspond to the Window they are in rather than the index where they are located.

Restrain yourself from posting if you arent sure about. We should never mislead people when they are in dire need of answers.