Forum Discussion

Kirangatti's avatar
Kirangatti
New Contributor
13 years ago

Flex | DropDownList

Hi,



I am new to test complete tool and I have a probelm while selecting an item from the dropdown list. Please help me on this



Below mehtods did not work(this was done using name mapping)

Aliases.iexplore1.pageEqsprojWorkflowDashboardRequ.objectMain.mainMain0.scrollerScroller3.mainmoduleMainmodule59.formhostPluginformhost.formloaderFormloader3265.scrollerScroller3796.formForm3862.BorderContainer(0).DropDownList("requestorGroupDD").ClickItem "USA"



Aliases.iexplore1.pageEqsprojWorkflowDashboardRequ.objectMain.mainMain0.scrollerScroller3.mainmoduleMainmodule59.formhostPluginformhost.formloaderFormloader3265.scrollerScroller3796.formForm3862.BorderContainer(0).DropDownList("requestorGroupDD").SelectItem "USA"


When I execute the above command one after the other the following same error got displayed for both the statements

Error Message: Cannot activate the 'USA' item.





When I recorded, the script was in a diffent way as mentioned below


Call formLoader.scrollerScroller3796.formForm3862.dropdownlistDropdownlist4649.Click(412, 9)



Call scroller.labelLabel6344.Click(116, 5)


Kindly specify what could be the problem and how to use the methods / properties without any error for the dropdown list for a flex object





Thanks & Regards,

Kiran





  • 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
  • Kirangatti's avatar
    Kirangatti
    New Contributor
    Hi Vijay,



    Thanks for the solution.



    I will implement this once the below issue gets resolved as I am unable to get the property names to use it in the child objects.

     Object Spy | Performance Issue



    I was wondering why Testcomplete doesn't identify the list item when recorded or doesn't perform the required action when scripted manually(selectitem, clickitem, etc..).



    I am actually trying to select the item without using Childobject concept.



    Please share if you have any other solution.



    Thanks And Regards,

    Kiranbabu Gattineni
  • shigeru_nakagak's avatar
    shigeru_nakagak
    Occasional Contributor
    Does this issue solve?

    I'm having same problem here.

    I can't use this test tool, always I have to edit test code after each recording.



    This problem happend mx:DataField (Flex 3 component). It could not select the date and report an error.



    What should I do?





    thanks



    Shigeru Nakagaki




  • Hi Shigeru,


     


    Could you please contact our Support team and provide them with your TestComplete project along with the log of the failed test execution? Besides that, please specify which TestComplete version you are using.