Micro Focus QTP (UFT) Forums
How to click links with same name in a webtable? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to click links with same name in a webtable? (/Thread-How-to-click-links-with-same-name-in-a-webtable)



How to click links with same name in a webtable? - qtplearner88 - 05-24-2012

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


RE: How to click links with same name in a webtable? - sshukla12 - 05-24-2012

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


RE: How to click links with same name in a webtable? - qtplearner88 - 05-24-2012

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


RE: How to click links with same name in a webtable? - sshukla12 - 05-25-2012

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


RE: How to click links with same name in a webtable? - Jeffm33 - 06-06-2012

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.