Finding thed innertest of a WebElement in a WebTab
Hi everyone,
I am trying to get the value of a web element in a table. I only want the data in column 5 of the WebTable.
So far I have:
For r = 1 to RowCount
If r <> 2 Then
ColCount = TableObj.ColumnCount(r)
For c = 1 to ColCount
ChildCount = TableObj.ChildItemCount(r, c, "WebElement")
If ChildCount > 0 Then
For k = 0 to ChildCount - 1
rNumber = rNumber +1
Set WebObj = WebElementObj.ChildItem(r, c, "WebElement", k)
NumberOfPages = WebObj.GetROProperty("innerText")
'Retrieve the column index
objExcel.Cells(rNumber, 1).Value = NumberOfPages
Re: Finding thed innertest of a WebElement in a WebTab
Sorry Antoney,
I am not able to just grab the 5th column innertext value which should be a number or empty. My code is finding all WebElements. In the 5th coulmn of the WebTable, I should find the number I need. But my code (and reopeated tries, fails to grab the number.
I trried changing c to be 5, or c=5 (no For loop), but I get:
Re: Finding thed innertest of a WebElement in a WebTab
Thx Honey,
I tried that in the past with no luck:
'Find table to extract data from
Set TableObj = Browser("Wisdom").Page("Wisdom IA_2").Frame("parent").WebTable("Select All")
rNumber = 1
RowCount = TableObj.RowCount
For r = 1 to RowCount
If r <> 2 Then
ColCount = TableObj.ColumnCount(r)
For c = 1 to ColCount
'msgbox ColCount
ChildCountPage = TableObj.ChildItemCount(r, c, "WebElement")
'msgbox ChildCountPage
If ChildCountPage > 0 Then
For k = 0 to ChildCountPage - 1
rNumber = rNumber +1
Set WebObj = TableObj.ChildItem(r, c, "WebElement", k)
NumPages = WebObj.GetCellData("innertext")
'msgbox NumPages
If c = 5 Then
'Retrieve the column index
objExcel.Cells(rNumber, 6).Value = NumPages
End If
Next
End If
Next
End If
Next
Re: Finding thed innertest of a WebElement in a WebTab
I created a dummy table and put this code in and i am getting data.
<font class="small">Code:</font><hr /><pre>
RowCount = Browser("Test").Page("Test").WebTable("h1").RowCou nt
Set TblObj = Browser("Test").Page("Test").WebTable("h1")
For r = 1 to RowCount
msgbox TblObj.GetCellData(r, 5)
Next