Forum Discussion

kavya_v's avatar
kavya_v
Occasional Contributor
9 years ago

issue in selecting values from drop down

I have to select values from dropdown iteratively and im using the following code.

I can get the full name of the dropdown item but storing the value in a varaible and using it doesnot work

 

Can any1 please tell where i went wrong.??

for i=0 to 1
Aliases.RCWinTrans9.wndRCWinTransX8Class.MDIClient.Acti_9_Smart_Test.Item.splitbuttonLanguages.dropdownbuttonOpen.Click

 

'To get the full name of dropdown item iteratively

name=NameMapping.Sys.RCWinTrans9.Item.GetUnderlyingObject.Child(i).FullName

 

'log full name of the child in the dropdown

'This is working absolutely fine

log.Message(name)

 

Aliases.RCWinTrans9.wndRCWinTransX8Class.MDIClient.Acti_9_Smart_Test.Item.splitbuttonLanguages.dropdownbuttonOpen.Click

 

/I am trying to click on the name ,but this throws runtime error

name.click

6 Replies

  • Hi kavya_v,

     

    The error is that you are trying to call the method "Click" in a variable that holds a string. 

     


    /I am trying to click on the name ,but this throws runtime error

    name.click

    'name is just a string at this moment.

    __________________________________________________________________________________

    Try this:
    Eval(name).Click()
    Let me know if that helps.
    Best regards,
    Leandro de Araújo Souza

     



    • kavya_v's avatar
      kavya_v
      Occasional Contributor

      Hi Leandro de Araújo Souza,

       

      That worked for me.

       

      Thanks a ton.

       

      Regards,

      kavya v

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        If you look in the tab at the bottom of the test log, does it give details about the runtime error?

  • balathavamani's avatar
    balathavamani
    Occasional Contributor

    Hi kavya,

     

    For selecting values from dropdown list you can use this code ["ClickItem"]("Pass your Value here"); followed by Dropdown object name.

     

    for Example:

     

    var item= "values at Index1" ;

     

    var Dropdown =Sys["Process"]("Sample")["Object"]("HwndSource: MainWindow",0)["ClickItem"](item);

     

    Please try this & let me know.

     

    Thanks

    Balamurugan Thavamani