Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Webtable contains cell contains two links, how to click on link
#1
Solved: 10 Years, 8 Months, 2 Weeks ago Question 
Hi all,
In webtable contains a cell contains three links and how to click on the particular link.
Reply
#2
Solved: 10 Years, 8 Months, 2 Weeks ago
Check ChildItem method for webtable object. It should help.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 10 Years, 8 Months, 2 Weeks ago
Hi srinivassure,

below is the code which can be useful to click the specific link in a web table

Code:
set a = Browser("B").Page("P").WebTable("WT:").ChildItem(1, 1, "Link", 2)

"2" denotes the 2nd link in a same sell


Regards,
Gaveyom
Reply
#4
Solved: 10 Years, 8 Months, 2 Weeks ago
Hi Gaveyom,

what u had told its very correct but there is an alternative to it also.(if u want to practice more on DP)
U can use Descriptive programing.
look for all the links in web table
navigate through each link and click on the desired link
Code:
Set odesc=Description.Create()
odesc("micclass").value="link"

Set l_link=Browser("a").Page("b").WebTable("c").ChildObjects(odesc)
For i=0 to l_lionk.count-1
    If l_link(i).Name="XX" Then
        l_link(i).Click
    End If
Next

Correct me if wrong

Regards,
Sankalp
Reply
#5
Solved: 10 Years, 8 Months, 2 Weeks ago
Yup it worked for me with some changes....

its saying 'Name' property not supported for link....so just changed condition to 'Exists' and it worked.

Thanks!
Reply
#6
Solved: 10 Years, 8 Months, 2 Weeks ago
Hi
If we use Exists, then only the first link will be clicked but not the desired link.
so we can use following
Code:
Set odesc=Description.Create()
odesc("micclass").value="link"

Set l_link=Browser("a").Page("b").WebTable("c").ChildObjects(odesc)
For i=0 to l_lionk.count-1
link_Title=l_link(i).GetROProperty("innertext")
If link_Title="XX" Then
l_link(i).Click
End If
Next
Reply
#7
Solved: 10 Years, 8 Months, 2 Weeks ago
When am using the above code am getting an error as Object Required.

Can you please suggest me the solution for this problem

Thanks
Ranjani.S
Reply
#8
Solved: 10 Years, 8 Months, 2 Weeks ago
The "2" denotes the 3rd link in the cell actually. Indexing starts at 0, representing the first element.
Reply
#9
Solved: 10 Years, 8 Months, 2 Weeks ago
Code:
Set odesc=Description.Create()
odesc("micclass").value="link"
Set l_link=Browser("a").Page("b").WebTable("c").ChildObjects(odesc)
For i=0 to l_lionk.count-1
link_Title=l_link(i).GetROProperty("innertext")
If link_Title="XX" Then
l_link(i).Click
End If
Next

The above objects a, b and c properties are not present in your object repository so try to modify as per your requirements
Reply
#10
Solved: 10 Years, 8 Months, 2 Weeks ago
(02-07-2011, 06:47 PM)srinivassure Wrote: Hi all,
   In webtable contains a cell contains three links and how to click on the particular link.


Code:
Set MyWebTable = Browser("Browser").Page("Page").WebTable("Google.com")
RowCount = MyWebTable.RowCount
For rowno = 1 to RowCount
ColCount = MyWebTable.ColumnCount(rowno)
For colno = 1 to ColCount
RowColCellData = MyWebTable.GetCellData(rowno,colno)
LinkCount = MyWebTable.ChildItemCount(rowno,colno,"Link")
If LinkCount > 0 Then
set LinkInCell = MyWebTable.ChildItem(rowno,colno,"Link",LinkCount-1)
If LinkInCell.GetROProperty("text") = "Facebook.com" Then ' Or whatever the text property is for the required link
LinkInCell.Click
End If
End If
Next
Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  click each web link in a page using Index or other method in QTP smeijer 13 23,642 04-29-2017, 04:53 PM
Last Post: kowshik
  How to get the links which appears on mouse hover of parent link rajendra649 9 34,798 03-10-2017, 06:35 PM
Last Post: satish00k
  [UFT] Wpf Label: click on image into cell robertosalemi 1 2,316 05-03-2016, 05:46 PM
Last Post: robertosalemi
  Getting links from a cell bistritapcv 2 3,339 03-29-2016, 05:48 PM
Last Post: siddheshbhavasar
  Webtable Checkpoint to get cell data from dynamic WbfGrid Neetha 1 3,325 08-20-2015, 11:43 PM
Last Post: ADITI1992

Forum Jump:


Users browsing this thread: 1 Guest(s)