QTP 11 – Flex 4 – Dropdown with scrollbar

Spread the love

Few days back, one of our automation tester came across a weird problem in Flex 4 application. We could able to set the selected item for the dropdowns which are not having scrollbars, but the ones having scrollbars were not able to set the appropriate item.

While initally I thought it could be a problem with the custom components that we have built, I thought of testing the QTP against following approaches
1. MX dropdown
2. Sprk dropdown
3. Combo box

To my surprise, QTP couldnt able to set the appropriate item for all of these controls. While this was bit disheartning, there was no other way but to find a solution as it was like a showstopper for the application. After spending quite a few hours, I could able to figure out following code (There could be performance problems with the code, as it has been long time I have coded in VBScript)
Function findItem (selectName, c) For i =0 To c.Count-1 it = c(i).GetROProperty("automationname") If it = selectName Then Browser("Browser").SparkApplication("MyApp").SparkNavigatorContent("index:3").FlexBox("index:29").SparkPanel("MyPanel").SparkSkinnableContainer("ComboBoxEntityType").SparkDropDownList("index:2").Select selectName findItem=True Exit function End If next findItem = false End Function Function iterateAll(selectName, iterateIndex) Set c=Browser("Browser").SparkApplication("MyAppp").SparkNavigatorContent("index:3").FlexBox("index:29").SparkPanel("MyPanel").SparkSkinnableContainer("ComboBoxEntityType").SparkDropDownList("index:2").ChildObjects v = findItem(selectName,c) If v=false Then iterateIndex = iterateIndex+1 Browser("Browser").SparkApplication("MyApp").SparkNavigatorContent("index:3").FlexBox("index:29").SparkPanel("MyPanel").SparkSkinnableContainer("ComboBoxEntityType").SparkDropDownList("index:2").SparkScrollBar("verticalScrollBar").Change iterateIndex * 21 iterateAll selectName, iterateIndex End If End Function selectName = "Others" Set cmb=Browser("Browser").SparkApplication("MyApp").SparkNavigatorContent("index:3").FlexBox("index:29").SparkPanel("MyPanel").SparkSkinnableContainer("ComboBoxEntityType").SparkDropDownList("index:2") cmb.Open tc = cmb.GetItemsCount Set c=cmb.ChildObjects iterateAll selectName,0


  1. Hi, really like the appearance of ones website. Can you mind saying what theme youre making use of? I’m not used to this and i am hoping to have mine looking anywhere close to cool as yours. Many thanks.


Leave a Comment.