Micro Focus QTP (UFT) Forums

Full Version: How to click links with same name in a webtable?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I have a web portal. In that there is one table of 4 rows and 5 coulmns. The last column contains links. These links are of same name. There is not html id for those links. Only distinguishing factor is index property(ordinal identifier). But I am not sure how to use that.

I would like to read the rows and columns first and have to click the links as I wish. Is this possible or is there any other way.

Please help me in this. Thanks in advance!!



Regards
QTPlearner
Hi,

U have 4 rows and 5 columns and u want to click the link on last column.
To Click a particular link u first read the data from coulmn 1 or 2 for a particular row, if this is what u r looking for in this table and get the row id and click the link on that particular row id.

Let me know in any queries.

Regards,
Sankalp
Hi Sankalp,
How to get the row id?? is that a html id?
Can you please give an example so that it will be easy for me to understand? Thanks!

Regards
QTPlearner
Hi,
No, html id and row id are different. U have to navigate through all rows using for loop.
Code:
For i=1 to rowcount
if <condition to check the required data on particular cell of table>
set objLink=Browser().page().webtable().childitem(i,5)-->get the link to Click
objLink.Click
msgBox("Row id for this link was"&i)
Next


This is a rough code..u can get a feel of what u need to do.
Regards,
Sankalp
You can also use the index function, which correspond to the link order in the object. Index 1 = link 1, Index 2 = link 2, etc. However, this will result in clicking the wrong item if the "correct" links aren't always the same index item.