Forum Discussion
Why aren't you using the "ClickItem" method on your combobox control? (https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/combobox/clickitem-action-combobox-control.html)
Seems that this is a much cleaner way of selecting an item from a combobox than first clicking the drop down then clicking the item. However, different components and different implementations of components may mean you need to use another method, but I'd suggest at least investigating this option as it should take care of both clicking the drop down AND clicking the individual item itself.
- Colin_McCrae8 years agoCommunity Hero
tristaanogre - "Why aren't you using the "ClickItem" method on your combobox control?"
Might not support it. Not all do. I have some Delphi ones that I have to use other methods. (Data driven, with visible selections populated "as you scroll" from the underlying DB. They're a pain.)
cam_farineau - "But at this time of my program, "HasItems" is already true because I used this ComboBox previously (Items are already loaded). So I can't use this property to know when I can click on the items."
Is the ComboBox a mapped object? You may just need to refresh it before using it again. (Refresh it before you load the page, which should effectively "empty" the cached version.)
- cam_farineau8 years agoContributor
Thanks for your answer.
I did try the refresh but it was not working.
I finally find a workaround for this problem (hard delay).
- tristaanogre8 years agoEsteemed Contributor
I personally don't like hardcoded delays if I can avoid them... from one test run to another, or on a different environment, it's entirely possible that the delay might not be long enough so you end up with intermittent problems.
As Colin_McCrae mentioned, this is apparently one of those ComboBoxes that does not easily support the "ClickItem" method so obviously my previous suggestion doesn't work. What I would suggest, though, instead of a hardcoded delay, see if you can find a particular property of the drop down that, when it is fully ready to receive a click, you can detect. You can then use the "WaitProperty" method on the drop down to wait specifically for that property to have the desired value. This will remove the need for the hardcoded delay and make your test script able to handle a more variable set of situations.
Related Content
- 4 years ago
- 6 years ago
- 11 years ago
Recent Discussions
- 4 hours ago