0

I Have two objects in same page but with different locations(tabs), I want to verify those objects each a part ...

i cant uniquely any of objects because the have same properties.

enter image description here

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Manaysah
  • 375
  • 5
  • 15
  • 29
  • 2
    I don't understand the problem, do the elements in both tabs exist in the HTML at all times or do only the objects in the selected tab exist? Do you have a publicly available URL that displays this? – Motti Dec 03 '12 at 13:02
  • yes, the problem is that the elements in both tabs exist in the HTML at all time even though the other tab not selected. this web is localy for our firm vpn – Manaysah Dec 04 '12 at 07:45

3 Answers3

2

These objects clearly are unique to a point because they have completely different text, this means that you will be able to create an object to match only one of them. My suggestion would be to look for the object by using its text property, one of them will always have "Top Ranking" the other you wil need to turn into a regular expression for the text and will be something "Participants (\d+)".

I am assuming that this next answer is unlikely to be possible so saved it for after the answer you are likely to use but the best solution would of course be to get someone with access to give these elements ids for you to search for. This will in the long term be much easier for you to maintain and not using text will allow this test to run in any language.

Paul Harris
  • 5,769
  • 1
  • 25
  • 41
  • Thanks, but the links displayed in both tabs are dynamic, so i cant verify if the object are displayed correctly in correct tab. which is the problem – Manaysah Dec 04 '12 at 07:55
  • 1
    What is dynamic about them? You mean the data inside the tabs rather than the tabs themselves? Your question is not very clear. – Paul Harris Dec 04 '12 at 08:37
  • yes, i want to verify the objects inside the tabs ... i cant ensure if the object(link) displays in (Participant) tab or in (TopRanking) tab.. the QTP sees both whatever the which tab is opened. – Manaysah Dec 04 '12 at 11:22
  • 1
    What you could then do is check for the existence of the rank/progress column because if that exists then you know you are on the top ranking page rather than participants and that the links on the page. Or are you saying you can read both lists regardless? if you can read both lists i would then look into getting a table element (both tables) then determining which table is the one you want (rank/progress again) and then get the elements from the table. – Paul Harris Dec 04 '12 at 12:52
  • Thanks Paul, but here is the problem becuase both tabs have same container webelement, there is no webtable. – Manaysah Dec 04 '12 at 16:53
  • 1
    Can you copy the source of the page to somewhere? Then I can have a look! – Paul Harris Dec 04 '12 at 17:48
1

Manaysah, do these objects have different indexes? Use the object spy and determine which index they have, the ordinal identifier index may be a solution to your problem. You could also try adding an innertext object property if possible, using a wildcard for the number inside the () as it appears dynamic.

  • This isn't exactly the answer to the question, but rather a comment. I do appreciate though that you don't have enough rep to post comments... – Aleks G Dec 03 '12 at 16:32
  • I had tried solving the issue with indexes,inner text but not working. in both tabs after setting indexes the QTP still see all objects from both tabs. and the inner text for both tabs is the same ... your help is highly appreciated ... – Manaysah Dec 04 '12 at 07:49
-2

try using xpath for the objects...xpath will definitely be different

Nirali
  • 1
  • Your answer is unclear, include some code snippets and further explanation to bring this up to par with Stack Overflow standards. – randomusername Dec 27 '13 at 07:02