Forum Discussion
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.)
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.- cam_farineau8 years agoContributor
Thanks for your answer.
I don't like hardcoded delays neither. In some case we are waiting for nothing and sometimes, like you said, the delay is not long enough.
Yes the ComboBox doesn't support the ClickItem.
I wanted to wait for the property IsDropDownOpen to be true but this is not working correctly, this property is true before the ComboBoxItem are loaded.
And I can't find another property, instead of HasItems, that proves the ComboBox is ready to receive a click.
I have some ComboBoxes that have a Loading item. So right now, I am waiting for this item to be gone before clicking on a particular item of the ComboBox.
Right now I don't have a perfect solution but those workaround are working.
- tristaanogre8 years agoEsteemed Contributor
Yeah, sometimes Delay is the only thing that works. Happy automating!
Related Content
- 4 years ago
- 6 years ago
- 11 years ago
Recent Discussions
- 4 hours ago