Facebook

Course Name Start Date Time Duration Registration Link
No Training Programs Scheduled ClickHere to Contact
Please mail To sudhakar@qtpsudhakar.com to Register for any training

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 ... >>
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"

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