Re: Get the index of test object

1,715 views
Skip to first unread message
Message has been deleted

mrinal rao

unread,
Nov 19, 2008, 3:16:24 AM11/19/08
to Mercu...@googlegroups.com
U cant get a index like this it's not a property of an object.

On Wed, Nov 19, 2008 at 11:21 AM, mabobine <raheel...@gmail.com> wrote:

Hi,

I need to know what is the index of the object. For that, I did the
following

Set x = description.Create
 x = Browser("ABC").Page("XYZ").WebEdit("Location").GetROProperty
("index")
msgbox (x)

msgbox displays empty
Message has been deleted

Sourabh Arora

unread,
Nov 19, 2008, 4:33:46 AM11/19/08
to Mercu...@googlegroups.com
wht u can do ...is set dropdown option in Tools->options to index nad then reccord the application and from the object repository u can find the index...

On Wed, Nov 19, 2008 at 2:15 PM, mabobine <raheel...@gmail.com> wrote:

So there is no way I can get the index of an object?





--
Never Believe wht the lines of ur hand predict abt ur future, because people who donot have hands also have a future
Message has been deleted

Sourabh Arora

unread,
Nov 19, 2008, 5:00:49 AM11/19/08
to Mercu...@googlegroups.com
object identification ->ordinal identifier as index

On Wed, Nov 19, 2008 at 3:18 PM, mabobine <raheel...@gmail.com> wrote:

I couldn't find the option there. Can you please provide the exact
location from where this option can be selected.

Thanks

Message has been deleted

Roman Zilber

unread,
Nov 19, 2008, 9:35:27 AM11/19/08
to Mercu...@googlegroups.com
Use GetTOProperty

On Wed, Nov 19, 2008 at 5:03 AM, mabobine <raheel...@gmail.com> wrote:

That would identify the object by index, if i am not wrong. What my
question is if there is any way to get the index of the object.

Regards


Message has been deleted

Roman Zilber

unread,
Nov 20, 2008, 11:53:26 AM11/20/08
to Mercu...@googlegroups.com
You right, it doesn't work.
Why do you need to know the index?

On Thu, Nov 20, 2008 at 12:43 AM, mabobine <raheel...@gmail.com> wrote:

x = Browser("XYZ").Page("ABC").WebEdit("A12").GetTOProperty("index")

msgbox (x)

Displays empty



Biswajit Agarwal

unread,
Nov 20, 2008, 12:56:06 PM11/20/08
to Mercu...@googlegroups.com
if i am correct it wont work because the index is the QTP's index its not application index. QTP will display only application data bnot its own data...  correct me if i am wrong..  actaully touching QTP after 2 yrs..

Roman Zilber

unread,
Nov 20, 2008, 1:03:51 PM11/20/08
to Mercu...@googlegroups.com
That right:) Also once you have reference to real object, you don't need its index.
You probably have number of similar objects and want to find one of it. There are different ways doing it...
Look to this presentations, it may inspire you :)

http://www.slideshare.net/yassa/qtp-descriptive-programming/
http://mercuryquicktestprofessional.blogspot.com/2006/11/descriptive-programming-simplified.html
Message has been deleted

Roman Zilber

unread,
Nov 21, 2008, 9:45:06 AM11/21/08
to Mercu...@googlegroups.com
In order to find an object during playback QTP need to store number unique attributes about the object. Most of such attributes you can access with GetTOProperty, the web page can be closed, but you can call obj.GetTOProperty("abc") - the information comes from Object Repository. (We just have found it doesn't work for ordinal identifier.)
Again: GetTOProperty exists to find objects from Object Repository. Information about such attributes you can find in QTP help "WebEdit identification properties".


GetROProperty - exists to find real, run time properties of an object. Another way to retrieve that information WebEdit("abc").Object.<property name>
Information about <property names> can be found here http://msdn.microsoft.com/en-us/library/ms535841(VS.85).aspx (Attributes/Properties).

QTP uses TOProperties to match it with ROProperties, that means TOProperties of an object should be unique enough to match only one object on the screen. If there is no such properties, QTP uses ordinal identifier index or location. If you have 3 similar objects, QTP will assign index:=0 to first , index:=1 to second, index:=2 to third object.

This index doesn't exists outside of QTP.


On Thu, Nov 20, 2008 at 11:54 PM, mabobine <raheel...@gmail.com> wrote:

Thanks for the feedback..

Can you elaborate a little bit more on this

"...it wont work because the index is the QTP's index its not

application index. QTP will display only application data bnot its own
data...."

Isn't index the property of the test object? If yes, then as we can
play with the other properties, why can't we do the same with it.
Also, we can locate the index by providing the number by ourselves, so
why can't we provide the index prior to our guess of where it is
actually located.

Regards


Reply all
Reply to author
Forward
Message has been deleted
0 new messages