Forum Discussion

akash10's avatar
akash10
Occasional Contributor
9 years ago

How to Retrieve Data from Web Page in Tabular Format in TestComplete using VB Script

Hello There,

 

My team is testing data from the QlikView Application(A pivot table in the Application please see in the below attachment)

Path of applicationhttp://us-b.demo.qlik.com/QvAJAXZfc/opendoc.htm?document=qvdocs%2FItalian%20Schools%20Navigator.qvw&host=demo11&anonymous=true

 

Script used to get the data from WebPage(VB Script)

Sub Test2
Dim explorer
Dim btnStart
Dim browser
Set explorer = Aliases.explorer
Set btnStart = explorer.wndShell_TrayWnd.btnStart
btnStart.ClickButton
Call explorer.wndDV2ControlHost.DesktopSFTBarHost.SysListView32.ClickItem("Internet Explorer", 0)
Set browser = Aliases.browser
Call Browsers.Item(btIExplorer).Navigate("http://us-b.demo.qlik.com/QvAJAXZfc/opendoc.htm?document=qvdocs%2FItalian%20Schools%20Navigator.qvw&host=demo11&anonymous=true")


set vTextObject= Sys.Browser("iexplore").Page("http://us-b.demo.qlik.com/QvAJAXZfc/opendoc.htm?document=qvdocs%2FItalian%20Schools%20Navigator.qvw&host=demo11&anonymous=true").Panel("PageContainer").Panel("MainContainer").Panel("Document_36")
vQlikObject=vTextObject.contentText
log.Message "The text value is : " & vQlikObject
end sub

We are getting the output in the form of continous string.Instead we required the data in the tabular format in TestComplete

Please find the attachment for the output below.

 

The purpose of this output data from the web page needs to be compared with Excel file cell by cell

 

Could anyone please help how to get data in Tabular Format in TestComplete or other better way to obtain the output in proper format that can be compared with excel file.

 

 

PFA below

1 Reply

  • I can show you how to 'Split' the string. Each element in the string is actually delimited with the character Chr(10).

    The character Chr(10) is the New Line character.

     

    The contents of each cell is in the array 'a'. 

     

    Sub Example
          Dim a, x, page, vTextObject, vQlikObject
          Set page = Sys.Browser("iexplore").Page("http://us-b.demo.qlik.com/QvAJAXZfc/opendoc.htm?     document=qvdocs%2FItalian%20Schools%20Navigator.qvw&host=demo11&anonymous=true")
          Set vTextObject = page.WaitPanel("PageContainer", 3000).Panel("MainContainer").Panel(62)
          vQlikObject = vTextObject.contentText
          a = Split(vQlikObject, Chr(10), -1, 1)
          For Each x in a
                Log.Message "The text value is : " & x
          Next
    End Sub

     

    Hope this helps...