In Webtable first finding the Row count, Next Column count and getting the number of links / Webcheck boxes in a perticular cell based on the expected value matching with displayed value. Then performing the action on perticular Link with the index.
Code:-
Links
Dim objWebTable
Dim intRowCount , intRow, intColumnCount, intColumn, intLinksCount, intItemIndex, strLinkItem, blnExitFor
blnExitFor =False
Set objWebTable = Browser("Browser Name").Page("Page Name").WebTable("Web Table name")
intRowCount = objWebTable. RowCount
For intRow =1 to intRowCount
intColumnCount = objWebTable.ColumnCount(intRow)
For intColumn =1 to intColumnCount
strActualString = objWebTable.GetCellData(intRow, intColumn)
If UCase(Datatable.Value("expectedvalue","Global"))= UCase(strActualString) Then
Msgbox "strActualString - - "& strActualString
intLinksCount = objWebTable.ChildItemCount (intRow, intColumn, "Link")
For intItemIndex =0 to intLinksCount - 1
Set strLinkItem = objWebTable. ChildItem(intRow, intColumn, "Link" , intItemIndex)strLinkItem.Click ' Specify the required operations after clicking on linkNext
blnExitFor =True
Exit for
Next
End If
Next
If blnExitFor =True then
Reporter.Reporterevent Micdone,”Clicked on Link”, ”Clicked on link”
Exit For
End if
Next
WebCheckBoxes :-
In the below code covered for dynamic check boxes turn on functionality.
Scenario:- In Webtable check boxes are displaying Under one column (fixed) and number of check boxes are depended on number of rows.
Set objWebTable = Browser("Browser Name").Page("Page Name").WebTable("Web Table name")
intRowCount = objWebTable.RowCount ' objWebTable. RowReporter.ReportEvent micDone," Web table Row count"," No of Rows in the web table : - " & intRowCount
msgbox intRowCount
For intRow =2 to intRowCount
' msgbox intRow
Reporter.ReportEvent micDone," Web check box Row number ","Turned on Web Check Box , Row Number : - " & intRow
Set strLinkItem = objWebTable.ChildItem(intRow,0,"WebCheckBox",0)
strLinkItem.Set "ON"
Next
Tuesday, July 28, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment