Highlighted
Dharmeshkumar V Absent Member.
Absent Member.
491 views

Problem in identifying WebTable objects

I am stuck in a problem I need to automate a page having multiple html tables.

I am having a Browser("XYZ").Page("ABC") object. Page("ABC") contains more than 280 WebTables. Say for Example three of the tables are: WebTable("1"), WebTable("2") and WebTable("3"). When I am clicking "Highlight in Application" button in Object Repository(OR) for WebTable("A), QTP is highlighting WebTable("C"). When I am
clicking on button "Highlight in Application" button in Object Repository(OR) for WebTable("A), QTP is highlighting WebTable("C"). Same thing is happening when I am I am running, *.GetCellData method for a table. Method is not returning correct result.

Its difficult to use Ordinal Identifier property as same table is assigned three Index value.

Could anyone of you suggest any workaround here?
0 Likes
7 Replies
Henry Floyd Absent Member.
Absent Member.

Re: Problem in identifying WebTable objects

I have used the headers of the table to identify the table I want to use. So what i do is create a regular express in the object description.


property -> outerhtml
value -> .* Col1 .*

HTH
0 Likes
Dharmeshkumar V Absent Member.
Absent Member.

Re: Problem in identifying WebTable objects

I appreciate your reply Henry, but I cannot use innerhtml/outerhtml or any other inbuilt QTP property. Reason being they are properties are not unique, cannot be assumed or they contain a long string(hunded's of characaters)
0 Likes
Henry Floyd Absent Member.
Absent Member.

Re: Problem in identifying WebTable objects

My outerhtml does contain many chars several thousand but I use the req express and index = 0 to identify the table, works every time. If fact by using the method, I can have a more solid base of have to identify the table then use the index to get to the correct table I need to use.

I would still look at the id or class of the table to try and identity which table you need. other wise you have to loop through every table on the page and still use some type of qualifier to check to see if it is the correct table.

I have ever failed using the this method, just try and be creative.
0 Likes
Vi.Ve Absent Member.
Absent Member.

Re: Problem in identifying WebTable objects

My application page is having multiple webtables. when a new entry is made a new webtable is created. I tried identifying using the index value. as the index value is frequently changing to the new rows/webtable added to the page. Can you suggest me how can I identify the new entries that are created in the webpage?
0 Likes
Knowledge Partner
Knowledge Partner

Re: Problem in identifying WebTable objects

I'm with you on this Henry, we use innerText and index if needed and have no problems, some of our webtables are nested 4 deep with the other 3 having the same innerText.

Dharmeshkumar have you tried something like using the first 20 characters of innerText in a regex and index if required (you should be able to get the index by looking at the webtables parent heirarchy in the object spy. here's an example

Browser("X").Page("Y).WebTable("innerText:=NameAddresAgeOccupa.*","index:=2")


Mark Smith.
0 Likes
Vi.Ve Absent Member.
Absent Member.

Re: Problem in identifying WebTable objects

Hi Mark,

I looked that the InnerText. I can use the outertext. But my issues comes when I need to select the webtable which have their Index number changing when an item is added to the page. A New row means a new webtable. This row is not created in the end of the page but it is can be created in any row of the page. due to this once assigned index numbers are changing.

Thanks
0 Likes
Knowledge Partner
Knowledge Partner

Re: Problem in identifying WebTable objects

If it's always the last table you may be able tocompute its index using the ChildObjects method. Search the forum there are lots of examples.


Mark Smith.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.