Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 24th October 7.30 AM IST to 9.00 AM IST 45 Days WeekDay Online

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Thursday, January 21, 2010

How to click on dupllicate links in a WebTable?


How to click on dupllicate links in a WebTable?

In the below table all the links are having the same names and destinations. So when you read these links to object repository, it will add using index which will not work if any more links are added in the table.

In this cases We have to click on the links based on other cell values. In the below table the Id is unique. So we can write a script to identify the Id value row and click on the select link in the same row.
                                                                                  
Id Opened Closed Name Party Type Amount Status
Select 133 06/17/2009 16:57 w Advertiser Credit 123.0000 Pending
Select 132 06/08/2009 13:05 06/08/2009 13:06 abc Host Payable 2850.0000 Complete
Select 131 06/05/2009 18:31 abc Content Provider Payable 123.0000 Pending
Select 130 06/05/2009 18:29 abc Content Provider Payable 101.0000 Pending
Select 129 06/05/2009 18:25 abc Content Provider Payable 76767.0000 Pending
Select 128 06/05/2009 18:21 abc Content Provider Payable 123.0000 Pending
Select 127 06/05/2009 18:02 abc Content Provider Debit 444.0000 Pending
Select 126 06/05/2009 17:57 def Content Provider Debit 111.0000 Pending
Select 125 06/04/2009 16:52 def Content Provider Payable 111.0000 Pending
Select 124 06/04/2009 15:49 06/04/2009 15:53 def Advertiser Receivable 165.0000 Complete
Select 123 06/04/2009 14:57 def Advertiser Debit 100.0000 Pending
Select 122 06/04/2009 13:46 06/04/2009 13:48 Fghi Host Debit 150.0000 Complete
Select 121 06/04/2009 13:45 06/04/2009 13:49 Fghi Host Receivable 150.0000 Complete
Select 120 06/04/2009 13:38 06/04/2009 13:49 Inc Advertiser Debit 250.0000 Complete
Select 119 06/04/2009 13:37 06/04/2009 13:49 Facek Host Credit 1500.0000 Cancelled
         
2 3 4 5 ... >>
Download the Sample WebTable from Here
This Function will click on the select link based on id Provided.
'************************************************************
Function ClickSelectLinkbyId(oTableObject,Id)
rc=oTableObject.RowCount
For r=1 to rc
If cstr(id)=trim(oTableObject.GetCellData(r,2)) then
CellRow=r
Exit For
End if
Next
Set lnkObj=oTableObject.ChildItem(CellRow,1,"Link",0)
lnkObj.click
End Function
'************************************************************
RegisterUserFunc "WebTable","ClickSelectLinkbyId","ClickSelectLinkbyId"
Browser("Browser").Page("Page").WebTable("Id").ClickSelectLinkbyId(132)
UnregisterUserFunc "WebTable","ClickSelectLinkbyId"

Download the Sample WebTable from Here

2 comments :

  1. hi,

    user needs to select based on type, id, status, is the same script will work

    another query is this applicable for frames also

    ReplyDelete
  2. The links to the sample WebTable do not work, can you please reloas them

    ReplyDelete