Forum Discussion
Well,
Your are trying 3 things in one line...
1) finding the object
Aliases.MyApp.MainFormBase.UltraToolbarsDockArea
2) checking availability of below item ..in collection
Tab|Group|Nonexistent Button
3) is that Item clickable...?
your code should work if it fails in 3rd point....and may be some times if there MyApp not available.
So you have check exists of the object like thi s
and if exist then get items collection more on lists
loop through it to check your item exist
then click.
- baxatob8 years agoCommunity Hero
Also note, that try-except statement catches only python exceptions (runtime, attribute etc). ItemNotFound is not exception for python, it's a kind of error, which controlled by TestComplete engine.
- jmassey8 years agoContributor
Hmm. Still not very sure how I should proceed from here.
The base item (your #1 thing) definitely exists. It's Infragistics' version of a Ribbon control, similar to those in newer versions of Microsoft Office. #3 is also definitely okay - the button is clickable when I try to click it.
The #2 thing is where things break down: Buttons are addressed as 'Tab|Group|Button' for ClickItem(). These correlate to Tab.Caption, Group.Caption, Tool.CaptionResolved (or indices, but I use captions so I can tell easily what is being clicked for logging purposes). At the time I build my to-do list for the script (could be at any time), the button, using that object-finding approach, exists and is clickable. At the time I want to click on it, it definitely is still clickable, but may or may not be findable, because the CaptionResolved may have changed (some of our buttons change their caption situationally).
I think I have a viable workaround, but it still feels kind of kludgey being unable to deal with script-halting errors as they happen. Is there something like the OnUnexpectedWindow event, for example, where I can add additional logic to the event to try to resolve known problems before the script gives up?
Related Content
Recent Discussions
- 3 hours agoSlickRick
- 4 hours agoSlickRick
Name Mapping Issue
Solved6 hours agokgreger1