Hi Bindu,
if Drop-down items(ABC) invisible follow below code.
Sub test
Dim ObjName, propNames, propValues
ObjName, propNames, propValues
propNames = Array("ObjectType", "ObjectIdentifier") * Take Object label Property
propValues = Array("DropDownList","DropDownList591") * Take Object label Value
set ListObject=ObjName.FindChild(PropNames,PropValues, 9) * list object not Found Increase Depth
ListObject.Click
ItemText="ABC"
Set dataProvider=ListObject.FlexObject.dataProvider
log.Message dataProvider
log.Message dataProvider.length
found = False
For i = 0 To dataProvider.length
If dataProvider.source.item(i).name=ItemText Then * Check the 'ABC ' in Data Provider (name/label) path hierarchy of ABC
ItemIndexByText = i
log.Message ItemIndexByText
ListObject.FlexObject.ensureIndexIsVisible(ItemIndexByText)
delay 2000
found = True
Exit For
End If
Next
If Not found Then
Log.Error "DropDownList item """ & ItemText & """ was not found."
'Exit Sub
End If
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
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
end sub
if DropDown Item is Visible Follow below code.
Sub test
Dim ObjName, propNames, propValues
ObjName, propNames, propValues
propNames = Array("ObjectType", "ObjectIdentifier") * Take Object label Property
propValues = Array("DropDownList","DropDownList591") * Take Object label Value
set ListObject=ObjName.FindChild(PropNames,PropValues, 9) * list object not Found Increase Depth
ItemText="ABC"
Set dataProvider=ListObject.FlexObject.dataProvider
log.Message dataProvider
log.Message dataProvider.length
found = False
For i = 0 To dataProvider.length
If dataProvider.source.item(i).name=ItemText Then * Check the 'ABC ' in Data Provider (name/label) path hierarchy
ItemIndexByText = i
log.Message ItemIndexByText
delay 2000
found = True
Exit For
End If
Next
If Not found Then
Log.Error "DropDownList item """ & ItemText & """ was not found."
'Exit Sub
End If
ListObject.Click
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
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
end sub
Let me know how this works for you.
Thanks,
Vijay
d.kavijay@gmail.com