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.

Friday, 29 March 2019

Find Objects on a Web Page and Save Values in Excel

'The following example retrieves the collection of WebEdit objects that 
contain credit card numbers 'and inserts them in an Excel file.

Dim NumberOfEdits

'Create a Description object to help retrieve all WebEdit objects in a specific page.
Set oDesc = Description.Create()
      'Retrieve all WebEdit objects from this page.
    oDesc("micclass").Value = "WebEdit"
Set EditCollection=Browser("Book a Flight: Mercury")_
                              .Page("Book a Flight: Mercury").ChildObjects(oDesc)
         NumberOfEdits = EditCollection.Count

'Use the GetROProperty to retrieve the "text" property (which in this case 
represents a credit card number) and insert all retrieved credit card numbers 
in an Excel file.

For i = 0 To NumberOfEdits - 1
     CurrentCreditNumber = EditCollection(i).GetROProperty("text")
     WriteToCreditCardNumberExcelFile (CurrentCreditNumber)
Next

No comments:

Post a Comment

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