Another Object Identification Issue
I am trying to pull data from specific objects on the screen, like I've done 100 times before. But the developers assigned special names to certain elements in order to make it easier to extract the data using the method GetROProperty, so I thought. But QTP cannot identify the object.
The SPY utility sees Webelements with "class:=entitlement", "class:=quantity", etc. However, the following code returns "false"
If Browser("micClass:=Browser").Page("micClass:=Page" ).WebElement("class:=entitlements").Exist(3)…
If Browser("micClass:=Browser").Page("micClass:=Page" ).WebElement("class:=Quantity").Exist(3)…
I tried several variations on this, but I think it would just confuse things if I explained what I did in those failed attempts.
What do I have to do to get this code to recognize the objects, so I can pull data from them? (Source HTML to be submitted as a separate post).
[Tarun] - Source code attached
Re: Another Object Identification Issue
Your issue is because of the ignorance of the facts that there are multiple objects with same class
Msgbox Browser("micClass:=Browser").Page("micClass:=Page" ).WebElement("class:=quantity","index:=0").Exist(3 )
Multiple objects of the same class, etc.
I was aware that there were multiple objects of the same class. When I added the identifier "index:=0", "index:=1", etc., QTP still indicated it could not find the object. I will experiment some more and see if there is something else wrong.
In the past I have attempted to use DP to access an object when there were multiple objects of that class present. QTP displayed a message indicating that it "saw" several objects that met the description and didn't know which one to use. I have used this technique before to determine if my Description was correct, before adding the Index to the code. Apparently QTP doesn't always display this message. The message suggested that QTP couldn't find ANY objects with this description,instead of indicating that there were muliple objects of this description.
I'll follow up on this thread.
Re: Multiple objects of the same class, etc.
I was unable to determine why QTP
- sometimes displays a message indicating that it found multiple objects that meet the dp criteria
- , and other times it displays a message stating that it can't find any objects when there are many on the screen that match the criteria.
My problem with the use of Index, which I omitted from the original post to try to keep it simple, was not valid due to typos and/or capitalization. Bottom line is, the INDEX feature is working fine, like it has many times in the past.