Saturday, October 21, 2017

WebTable

http://money.rediff.com/gainers/bse/daily/groupa?src=gain_lose

' capture total data table using SET into table
set table=Browser("creationtime:=0").Page("title:=.*").WebTable("class:=dataTable")

' to get the complete rows in a data table
TotalRows=table.RowCount

'to get columns of rows ,here 1 is 1st row
TotalColms=table.ColumnCount(1)

print "totals rows are "&TotalRows
print "Totals columns are "&TotalColms

print table.GetCellData(5,1)

' to get data of complete first column
print "****ROWS ITERATION***********"
For rowNum = 1 To TotalRows Step 1
    print table.GetCellData(rowNum,1)
Next

'to get the data of selected row all colums,here selected 5 row all columns
print "****column ITERATION***********"

For ColNum = 1 To TotalColms Step 1
    print table.GetCellData(5,ColNum)
Next

print "****TABLE ITERATION***********"

'to get data of complete data table

For rowNum = 1 To 5 Step 1
    print "***Print data :---"&rowNum

For ColNum = 1 To TotalColms Step 1
    print table.GetCellData(rowNum,ColNum)
Next
Next

companyName="MothersonSumiSystems"
 'it will also get row with cell data text.User defined function
For rNum = 1 To rows Step 1
cname=trim(table.GetCellData(rNum,1))
print cname & "------"&strcomp(cname,companyName)
If strcomp(cname,companyName)=0 Then
    print table.GetCellData(rNum,4)
    Exit for
End If
    Next
-------------------------------------------------------------------------
'Using of Functions := inbuilt function.
'GetRowWithCellText(companyName)
'GetCellData(runum,4)
set table=Browser("creationtime:=0").Page("title:=.*").WebTable("class:=dataTable")
companyName="MothersonSumiSystems"
runum= table.GetRowWithCellText(companyName)
print table.GetCellData(runum,4)

No comments:

Post a Comment

Description Programming

'==Descriptive Programming language 'creating the common browser and page object  Set  myPage= browser( "creationtime:=0...