views:

34

answers:

2

I'm just wondering if it's possible to uniquely identify a given object in an application through Quick Test Pro.

For example, if there are 10 Ok buttons on a web page, with no HTML or Javascript giving them unique identifiers, how would I choose the 3rd button?

Thanks for your help.

+2  A: 

You will have to use the index property in QTP.

AJ
So I would say something like index = 3 for the example above?
Riddari
Well, I think that the index starts from 0. So index=2 should be the 3rd button. webEdit or Button (index:=2)
AJ
A: 

If you want to click on 3rd button then you need to use settoproperty function of QTP.

'In the Object repository you have to add index property as optional identifiers and set it to '0 for the first button. The you can use

Browser("").Page("").Frame("").WebButton("OK").Settoproperty "index", 2
Browser("").Page("").Frame("").WebButton("OK").Click

'It clicks on the 3rd button.

sreeram