Ask a Question

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

russelld
Contributor

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 21
tristaanogre
Community Hero

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

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?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
russelld
Contributor

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

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
Community Hero

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

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")   
      }
}

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

tristaanogre
Community Hero

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

 lot of it depends upon the class of the object.  Looking at your screenshot, while this object is labeled as a "DropDown", it doesn't appear that TestComplete is recognizing it as such.  What is the WndClass of the object?

As for mapping the child objects...  Again, I wouldn't for the simple fact that it could be a dynamic list... the number of objects, etc., available are probably going to change and fluxuate and, in those kinds of situations, I typically don't map the objects but use some sort of "Find" method to find the object I want, assign to a variable, and then Click on it.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
russelld
Contributor

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

The WndClass isn't listed.  How do I get that added?

 

Thanks Again

tristaanogre
Community Hero

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

So, there's no WndClass property on the object (Object Spy, properties tab)?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
russelld
Contributor

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

 
russelld
Contributor

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

Sorry I know its been a long time since you wrote this...the script runs through but it still won't click the listitems.  Any other suggestions?

 

Thanks for the reply!

 

 

SaravanaKumar_N
Contributor

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

Does it throw any error message?

I can see the methods available for dropdown item in your previous screenshots. Can you share the properties and methods shown for the ListItem?

 

Also I noticed there is a 'Value' property at your dropdown. If your tests does not care about the way how the dropdown value is set.

You can try something like this...

ddlVehicle.Value = menuItem; 

I would suggest this only if you could not find any other option to set the value and if your test does not care the way the value is set.

cancel
Showing results for 
Search instead for 
Did you mean: