Monday, November 7, 2011

Clicking "webelement" within a cell of WebTable

This we can do more efficiently by using "Programmatic Descriptions" and substituting properties with variables(You can see in KB articles. But once case, I dont know why,"Programmatic Descriptions" did not work for me. Then I workaround by doing the below code :





numWTLen=Browser("Browser").Page("Page").Frame("Frame").WebTable("Table").RowCount

For i=1 to numWTLen

strConfigStatus=Trim(Browser("Browser").Page("Page").Frame("Frame").WebTable("Table").GetCellData(o,3))

If strConfigStatus="Configured" Then 'If this Condition satisfy, then only we are clicking "Web element" within Cell

'Putting Index value dynamically for every row.

DataTable.Value("Index",dtLocalSheet)=i 'Index starts from "0" but my Webtable first row contains Headings, hence i took index starts from "1"

Browser("Browser").Page("Page").Frame("Frame").WebElement("WebElement").Click

Exit For 'Exiting from "For" Loop

End If
Next


Note:Before executing the above code. we have to parameterize the " WebElement("WebElement")"
(right click on WebElement("WebElement") , choose object Properties and select "Parameter radio button").
property Name "Index" to "Local sheet" with Name "Index". And also obviously add "Index" property
to the " WebElement("WebElement")" property list and remove "innertext" property from property
list.

Example: WebElement("WebElement") contails two properties.
1) Name:html Tag Value=some tag
2) Name:Index Value=1


Thanks!
Raghubansh

No comments:

Post a Comment