Retrieve the Current State of a Check Box :
Sub GetROProperty_Example()
'The following example uses the GetROProperty method to retrieve
'the state of a check box.
Val = Browser("Mercury Tours").Page("Find Flights").WebCheckBox("roundtrip").GetROProperty("Value")
' val contains the ON or OFF state of the check box
End Sub
Retrieve the Value of a Property in an Edit Box :
Sub GetROProperty_Example()
'The following example iterates through the WebEdit objects
'on a page, searching for a specific WebEdit object in order
'to set a value for it.
Dim EditToSearch, ValueToSet, NumberOfEdits
'This is the value of the 'name' property for the WebEdit we want to find.
EditToSearch = "credit_card_number"
ValueToSet = "6543210123456789"
'Create a description object to help retrieve all WebEdit objects in a specific page.
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebEdit"
'Retrieve all WebEdit objects in this page
Set EditCollection = Browser("Book a Flight: Mercury").Page("Book a Flight: Mercury").ChildObjects(oDesc)
NumberOfEdits = EditCollection.Count
'Search for a specific WebEdit and set its value
For i = 0 To NumberOfEdits - 1
If EditCollection(i).GetROProperty("name") = EditToSearch Then
EditCollection(i).Set ValueToSet
End If
Next
End Sub
Retrieve the Value of a Property in an Edit Box
:
Sub GetROProperty_Example()
'The following example uses the GetROProperty method to retrieve
'the number of items in a WebRadioGroup.
NumOfItems = Browser("Mercury Tours").Page("Find Flights").WebRadioGroup("seat pref").GetROProperty("Items Count")
' NumOfItems contains "3"
End Sub
Post a Comment