Forum Discussion
rushikesh wrote:
In tested application there is combo-box option.Inside this combo-box there are 21 drop down options. I want to check if number of options present are 21.
Below is code I am using.
var list = ToolSelectFilter.ComboBox_ToolType;
Log.Message("No of tools are " +list.wItemCount);
Problem I am facing is that when code is executed Test Complete drop downs the list of combo-box 21 times to check all the options. This happens so fast (almost within 5 seconds) that my tested application crashes.
Is there another way to do this ?
Or
Is there a way to slow down execution of this code ?
wItemCount is a property that TestComplete puts as a wrapper around the combobox control. It gets this information from native properties on the object. I don't know for certain, but it is possible that TestComplete's interaction with your particular control is firing off some sort of event that your developers have put on the control so that, if that property is accessed, the drop down activates.
Investigate the properties of the component and see if the same value is in a different property that is not going through TestComplete's wrapper and see if the same problem occurs.
Also, if you have access to your development team, find out if there are any events that are triggered for code that enumerates the number of items in a drop down list.
tristaanogre has a point.
There could be custom event triggers in there. It may be a modified version of the base control. All sorts. Only the development team can tell you if it's modified in some way.
But, as tristaanogre says you can attempt to use other properties. You may/should find an array or list of all the options on there. Many/most drop down box type controls have this (but not all - I have one SQL driven one that loads on demand). It may be in an underlying recordset object or something. If you can get the list, you can check the length of it (array length, split a comma separated list, whatever). Which may be an option if getting such a property doesn't trigger the dropdown.
The only other way you can be activating it 21 times is if you're in some sort of loop that we don't know about. Otherwise, TC activating an event trigger somehow sounds like the only real possibility ...