Forum Discussion
HKosova
Alumni
15 years agoHi Vijay,
As I wrote in my reply to your other question, currently, TestComplete doesn't support Flex 4.6, therefore we cannot guarantee total compatibility with Flex 4.6 applications. However, it may work just fine if there are no breaking changes from Flex 4.5.
You can get the number of items in Flex combo box and list box controls using the ItemCount property and get the item text using the Item(Index) property. See the attached screenshot.
That's what the combo box item selection code in your example does, that is, it calls the ClickItem method of the combo box object and passes the item text as a parameter:
As for the Spark DropDownList control, currently, it's not fully supported by TestComplete, that's why item selection is recorded as coordinate clicks. To automate this control, you can use its native methods and properties that are accessible in tests via the FlexObject property. You can manually insert the needed properties and methods into your tests as shown in the following article:
Enhancing Flash and Flex Automated Tests with Native Object Methods in TestComplete 8.50
For example, to select a DropDown list item by index, you can use the following function:
To use this function in your script, replace these lines:
with the following ones:
Hope this helps.
As I wrote in my reply to your other question, currently, TestComplete doesn't support Flex 4.6, therefore we cannot guarantee total compatibility with Flex 4.6 applications. However, it may work just fine if there are no breaking changes from Flex 4.5.
unable get dropdown object propertys and propertys values.
You can get the number of items in Flex combo box and list box controls using the ItemCount property and get the item text using the Item(Index) property. See the attached screenshot.
How can i select specific DropDown list by passing parameter.
That's what the combo box item selection code in your example does, that is, it calls the ClickItem method of the combo box object and passes the item text as a parameter:
Call navigatorContent.bordercontainerBordercontainer43.comboboxListsearchfields.ClickItem("REFID")As for the Spark DropDownList control, currently, it's not fully supported by TestComplete, that's why item selection is recorded as coordinate clicks. To automate this control, you can use its native methods and properties that are accessible in tests via the FlexObject property. You can manually insert the needed properties and methods into your tests as shown in the following article:
Enhancing Flash and Flex Automated Tests with Native Object Methods in TestComplete 8.50
For example, to select a DropDown list item by index, you can use the following function:
' Selects an item in Spark DropDownList control
' Parameters:
' ListObject - a Spark DropDownList object
' ItemText - the text of the item to select
Sub ClickDropDownListItem(ListObject, ItemText)
Dim dataProvider, i, found, app, propNames, propValues, item
' Check if the drop-down list contains the specified item
Set dataProvider = ListObject.FlexObject.dataProvider
found = False
For i = 0 To dataProvider.length
If dataProvider.item(i).label = ItemText Then
found = True
Exit For
End If
Next
If Not found Then
Log.Error "DropDownList item """ & ItemText & """ was not found."
Exit Sub
End If
' Open the drop-down list
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")
propValues = Array("ListItem", ItemText)
Set item = app.FindChild(propNames, propValues, 5)
If item.Exists Then
item.Click
Else
Log.Error "DropDownList item """ & ItemText & """ was not found."
End If
End Sub
To use this function in your script, replace these lines:
Call navigatorContent.dropdownlistDropdownlist429.Click(74, 9)
Call vobject.group0.scrollerScroller871.listitemDefaultitemrenderer901.Click(60, 12)
with the following ones:
Dim dropDownList
Set dropDownList = navigatorContent.dropdownlistDropdownlist429
ClickDropDownListItem(dropDownList, "Item Text")
Hope this helps.
- hhagay10 years agoContributor
Is there a method in JS to select list_item from a dropdown similar to the one used in the example?