Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Webtable to datatable
#1
Solved: 10 Years, 9 Months ago
How to write the script for extracting the data from webtable to datatable?


Thanks inadvance
sandeep
Reply
#2
Solved: 10 Years, 9 Months ago
Here I am taking an Example of W3 Schools Site, in this website we have webtable like vbscript functions.

Code:
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe"
Browser("Google").Navigate "www.w3schools.com"
Browser("Google").Page("W3Schools Online Web Tutorials").Link("Learn VBScript").Click
Browser("Google").Page("VBScript Tutorial").Link("VB Functions").Click

rCount = Browser("Google").Page("VBScript Functions").WebTable("Function").RowCount

For i = 2 to rCount

    cCount = Browser("Google").Page("VBScript Functions").WebTable("Function").ColumnCount(i)
        sData1 = Browser("Google").Page("VBScript Functions").WebTable("Function").GetCellData(i,1)
    sData2 = Browser("Google").Page("VBScript Functions").WebTable("Function").GetCellData(i,2)
        DataTable("Function",dtGlobalSheet) = sData1
    DataTable("Description",dtGlobalSheet) = sData2
    DataTable.SetCurrentRow(i)

Next

Here I am taking an example of W3schools web application

Code:
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe"
Browser("Google").Navigate "www.w3schools.com"
Browser("Google").Page("W3Schools Online Web Tutorials").Link("Learn VBScript").Click
Browser("Google").Page("VBScript Tutorial").Link("VB Functions").Click

rCount = Browser("Google").Page("VBScript Functions").WebTable("Function").RowCount

For i = 2 to rCount

    cCount = Browser("Google").Page("VBScript Functions").WebTable("Function").ColumnCount(i)
    sData1 = Browser("Google").Page("VBScript Functions").WebTable("Function").GetCellData(i,1)
    sData2 = Browser("Google").Page("VBScript Functions").WebTable("Function").GetCellData(i,2)
    DataTable("Function",dtGlobalSheet) = sData1
    DataTable("Description",dtGlobalSheet) = sData2
    DataTable.SetCurrentRow(i)

Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Datatable add and datatable import sheet wheelercha 4 33,355 06-14-2012, 04:53 PM
Last Post: Arul
  Retrieving data from a webtable and Saving data to a DataTable Brian T. 5 9,152 07-16-2010, 03:49 PM
Last Post: sasmitakumari

Forum Jump:


Users browsing this thread: 1 Guest(s)