Forum Discussion
googleid_105206
14 years agoContributor
Hi Bindu,
Please follow below code to Click specific drop-down item.
propNames = Array("ObjectType", "ObjectIdentifier")
propValues = Array("DropDownList","combo_0")
set ListObject=Context.FindChild(PropNames,PropValues, 9)
ListObject.Click
ItemText="brand"
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).value=ItemText Then
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")
propValues = Array("ListItem", 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
Let me know how this works for you.
Thanks,
Vijay
d.kavijay@gmail.com
Please follow below code to Click specific drop-down item.
propNames = Array("ObjectType", "ObjectIdentifier")
propValues = Array("DropDownList","combo_0")
set ListObject=Context.FindChild(PropNames,PropValues, 9)
ListObject.Click
ItemText="brand"
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).value=ItemText Then
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")
propValues = Array("ListItem", 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
Let me know how this works for you.
Thanks,
Vijay
d.kavijay@gmail.com