Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Saturday 30 January 2021

Retrieves the collection of WebEdit objects, which has shipping details and inserts the information in an Excel file.


Dim numberOfEdits

'Create a Description object
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebEdit" 

'Retrieve all WebEdit objects from this page.
Set editCollection = Browser("Shipping").Page("Shipping").ChildObjects(oDesc)
numberOfEdits = editCollection.Count

'insert all retrieved information in an Excel file.
For i = 0 To numberOfEdits - 1
     CurrentInfo = editCollection(i).GetROProperty("text")
     WriteToExcelFile (CurrentInfo)
Next

' inseting values into excel
Function WriteToExcelFile (CurrentInfo)
    Dim oExcel, oWB, oSheet, setVal
    Set oExcel=CreateObject("Excel.Application")
    Set oWB=oExcel.Workbooks.Open("C:\test.xls")
    Set oSheet=oWB.WorkSheets("Sheet1")
    oExcel.Visible=TRUE  

    For i = 0 To CurrentInfo  - 1
         oSheet.Cells(i,1).Value=CurrentInfo    
    Next

    oWB.Save
    oWB.Close
    Set oExcel=Nothing
End Function


No comments:

Post a Comment

Note: only a member of this blog may post a comment.