Forum Discussion

russelld's avatar
russelld
Contributor
7 years ago

How do I setup my drop-down window to select the listItem?

Hi,

 

1. "ScreenShot01", the initial keyword test was setup as follows...Item - dropdownWoqthVehicId & Operation - Click

 

2. "ScreenShot02", "The name mapping editor found the selected drop-down item.  How do I set this up so the item is automatically selected when the script is run?

 

Thanks

Dave

21 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I wouldn't necessarily map individual items... depends somewhat on how TestComplete recognizes your drop down control.  If you do an Object Spy on your dropdown control, does it have a method like "ClickItem" associated with it?

    • russelld's avatar
      russelld
      Contributor

      No, the 'ClickItem' method is not there for the dropdown. 

       

      Also, should I Not map the 'child objects' for objects such as dropdowns, comboboxes, etc..?

       

      Thanks

      • shankar_r's avatar
        shankar_r
        Community Hero

        I see drop down object is having child nodes which i guess the list options.

         

        You can use FindChild to grab the listItem and make use of click method to click them.

         

        like below,

        function test(){
              dropdownObject.Click(); //click the the drop to expend
              
              aqUtils.Delay(1000,"waiting for list render");
              var listObject = dropdownObject.FindChild("<proname>","<propvalue>",1,true);
              if(listObject.Exists){
                    listObject.Click();
                    Log.Message("drop down clicked")
              }else{
                    Log.Message("drop down not clicked")   
              }
        }