Earlier, This blog post was supposed to explain how QTP identifies the objects but when, for curiosity, I typed in Google, I found 352 and more sites explaining the same. Some of them are so good that I didn’t find it useful to explain the same thing once again. It seems everybody knows how QTP identifies the objects. Still, if you have any concerned question, let me know by posting your questions in comment section.
So, when the initial idea was dropped, I thought to put a challenge on Object Identification by QTP. The challenge is very simple or at least it seems very simple but none of the QTP engineers I know could tell me the correct answer. This might be due to multiple reasons like:
- They were too busy with their other daily work challenges
- They didn’t find the challenge interesting enough
- They didn’t want to spend time on something irrelevant of their daily work
- They didn’t have tendency to explore about the new things
- They didn’t have enough courage to take the challenges
- etc.
If anyone of you have one of the same reasons, this post is not for you. You can leave the post here and can continue working on something else. Rest of you, please continue with the challenge given below.
Challenge:
Their is a login page which have two fields: Login and Password. I have made some small changes in the code so that both objects have the same properties. Once, it is done I have added both these objects in the object repository and set the same properties for both of them. Now, the situation is:
- Both of the objects have the same properties (except Logical Name which is not required for object identification)
- Ordinal Identifier is set to none
- Smart Identification is also disabled
Now, when I highlight, the QTP identifies the object correctly. The question here is how QTP is recognizing the objects correctly when every property of the two objects are same. Shouldn’t QTP display an error of existing of more than one object with same properties.
Download the Login Page and Object Repository for the reference.
Let me and others know if you have the answer or Please explore if you want to find out the answer yourself otherwise wait till someone post the correct answer. Please post your questions and answers as comments to this post.
(Credits to http://www.authpro.com/ for the login page)