Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP Unable to differentiate WebTable in Application - Solved
#1
Solved: 10 Years, 3 Months ago
I am working on an application where there are two different web tables displayed.

The second web table is detail description of the first web table so it displays when we select a row in the first web table. In other words, Each row in the first table is selectable and when selected corresponds to the second web table

The problem now I am facing is retrieving data from second web table for different entity of first one since all the property of the web table are similar expect the below property

"html ID" which corresponds to - "DetailParty_randomno"

This random number is the one which defines the uniqueness of the second web table, which can be retrieved from the first web table though it isn't found in the properties section when we use the Object spy. I can see this random number when I view the source code of the page. It's displayed as value entity in the tr tag

Value entity looks like "Party_randomno"

My question is if there a way to retrieve this value for each row and then use it in identifying the second web table?

However I did try to read from second table by hard coding "html id" in webtable property to see if it's being read but it didn't work So my second question is with respect to the correctness of the below descriptive programming code. Is there something else I need to include/exclude in the WebTable property to find uniqueness.

I also did my research and found that it's useful to use index but I am not aware on how to find the index of a web table? That explanation would also help me in my learning

Code:
Set ObjTable = Browser("name :=" &BrowserPage).Page("name := " & BrowserPage).WebTable("class:= Web_Table", "class name:= WebTable" , "html id:= DetailParty_7")


Update

I found a solution for one of my two problems in an another forum

1. Getting the Value Id - Solved
2. Parsing it to WT2 to uniquely identify it

For the first problem below is the solution. However my descriptive programming(first and last line) in the below is not working. Can you help me correct it?

Code:
BrowserPage = Browser("micClass:=Browser").GetROProperty("name")
Set desc = Description.Create()
desc("html tag").Value = "tr"
Set Rows = Browser("B").Page("P").Webtable("WT").ChildObjects(desc)
RoCounter = Rows.Count-1
For valuecount = 0 To RoCounter
    id=  rows(i).Object.GetAttribute("value")
Next
'When the right ID is got, parsing it in the below for WT2 Identification Id would be Party_1, Party_3 and so on. However for web table 2 html id needs to have "Detail" word in front of it
Set ObjTable = Browser("name :=" &BrowserPage).Page("name := " & BrowserPage).WebTable("class:= Web_Table", "html id:= Detail" &id)

Thanks in Advance
Reply
#2
Solved: 10 Years, 3 Months ago
Dear EnthustiaticLearner,
Thank you very much for the detailed explanation. My 2 cents would be to go with the index rather than pondering over an unique id. Index in itself is a problem solver in dynamic webtables as well as chained tables.

Index starts from Zero, so it is going to be a bit of trial and error before you arrive at the right one. Also, check the Spy to see what the index says? If it is has the right value you may use it. You can also record the object and check the index identification on the Object Repository.

Code:
Set ObjTable = Browser("name :=" &BrowserPage).Page("name := " & BrowserPage).WebTable("class:= Web_Table", "class name:= WebTable" , "index:=0")
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 3 Months ago
Thank you Basanth for your input. I do get the Index value as an Ordinal Identifier but the index value changes for each entity/user I am searching so I need to find the index during the run time before using it(Sorry about the bold item been dropped in my first post)

And just to be more elaborate on my previous post, this is how my source look like for a row in Web Table 1 with respect to tr tag

Code:
<tr style="background-color:yellow" value="Party_1" onclick="Call peoplehighlight(&quot;Party_1&quot;)" language="vbscript">

And an example for my Web Table 1 and 2 to get a detailed picture of what I am trying to say(I am sure you understood my first post, this is for people who are trying to help me and are not able to picture my first post) -

As an example The Page talks about details of a family for a person being searched

I search the user Enthusiastic Learner and navigate to the questioned page

Web table 1 contains something like below

____________________________________________
RelationShip | Name
____________________________________________
Father | AAA
____________________________________________
Mother | BBB
____________________________________________
Brother | CCC
____________________________________________
Sister | DDD
____________________________________________
Sister2 | EEE
____________________________________________


Web Table 2 Contains detailed information for each row in Web Table 1 as I earlier mentioned. First row Relationship is not selectable
____________________________________________
Details
____________________________________________
Name | AAA
____________________________________________
Age | 50
____________________________________________
Relationship | Father
____________________________________________
and so on
Reply
#4
Solved: 10 Years, 3 Months ago
This has been solved. There are some syntax error in my descriptive program such as spaces as evident in my first post.

For getting value from source code, you can use the similar code seen in my first post, ignoring the first and last line
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Link in a webtable in a webtable Soulwalker 1 2,665 07-19-2017, 01:44 PM
Last Post: Ankur
  How to identify dynamic webtable as unique in QTP? sudheendramurthy 4 18,047 02-23-2016, 06:16 PM
Last Post: vinod123
  Unable to click on WebButton in WebTable srach84 1 2,860 02-09-2015, 09:07 PM
Last Post: arpan
  Webtable actions are not getting recorded, but ObjectSpy is able to identify webtable sahilarora2000 2 3,600 06-13-2014, 04:27 PM
Last Post: vinod123
  Identifying a WebGrid using Div Tag - Solved EnthusiasticLearner 2 3,337 01-06-2014, 09:27 PM
Last Post: EnthusiasticLearner

Forum Jump:


Users browsing this thread: 1 Guest(s)