Hi Kiran,
Sub dropdownSelection()
Dim ListObject, propNames, propValues
propNames = Array("ObjectType", "ObjectLabel") * Take Object label Property
propValues = Array("DropDownList","mainmodule") * Take Object label Value
set ListObject=ObjName.FindChild(PropNames,PropValues, 9) * list object not Found Increase Depth
ItemText="USA"
Set dataProvider=ListObject.FlexObject.dataProvider
log.Message dataProvider
log.Message dataProvider.length
found = False
For i = 0 To dataProvider.length -1
If dataProvider.source.item(i).name=ItemText Then * Check the 'USA ' in Data Provider (name/label) path hierarchy of USA
ItemIndexByText = i
log.Message ItemIndexByText
ListObject.Click
ListObject.FlexObject.ensureIndexIsVisible(ItemIndexByText)
delay 2000
found = True
Exit For
End If
Next
If found =True then
Set app =ListObject.Parent
Do Until app.ObjectType ="Object"
Set app = app.Parent
Loop
' Find the list item object by text
propNames = Array("ObjectType", "Caption") * Take ObjectLabel/Caption/ObjectIdentifier
propValues = Array("DropDownList",ItemText)
Set item =app.FindChild(propNames, propValues, 2)
If item.Exists Then
item.Click
Log.message ItemText& "Select form Drop down list"
Else
Log.message ItemText& "Was not Select form Drop down list"
End If
Else
Log.Error "DropDownList item """ & ItemText & """ was not found."
End If
End Sub
Let me know how this works for you.
Thanks,
Vijay
d.kavijay@gmail.com