Ask a Question

OnOverlappingWindow Event works, but error still occurs

jmassey
Contributor

OnOverlappingWindow Event works, but error still occurs

image.png

 

So, the Warning log there happens at the start of my OnOverlappingWindow event. The Keyboard input is just pressing 'Esc' (the overlapping window in this case happens to be a tooltip, so this should work fine). It actually does clear the tooltip. Then that 'window was clicked with the left mouse button' is the test actually moving along successfully from the point where it was interrupted. Everything seems to be in order...except for some dang reason the Overlapping Window error still happens, and it kills my test. I don't want to disable Stop On Error, but when an error is handled correctly and I'm able to move on, why is it still making my test fail?

 

Here is the function in full that runs when that event happens. Everything in it seems to be functioning just fine:

 

def GeneralEvents_OnOverlappingWindow(Sender, Window, OverlappingWindow, LogParams):
    aqUtils.Delay(2500)
    Log.Warning('Overlapping Window')
    Log.Picture(Sys.Desktop.Picture(0, 0, -1, -1))
    Sys.Keys('[Esc]')    
    aqUtils.Delay(250)
    if OverlappingWindow.Exists:
        if OverlappingWindow.Visible and \
            OverlappingWindow.VisibleOnScreen:        
            if hasattr(OverlappingWindow, Minimize):
                Log.Warning('Attempting to minimize Overlapping Window')
                OverlappingWindow.Minimize()
    aqUtils.Delay(2500)
4 REPLIES 4
tristaanogre
Esteemed Contributor

It's making your test fail because an OverLappingWindow event that has an unmodified LogParams will log an error.  What you need to do is modify the properties of LogParams to change what is automatically logged from an error to a warning or, even, completely bypass the logging.


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

Okay. Why is it different than UnexpectedWindow, and what would I do if I want it to behave the same way? How do I modify LogParams?

NisHera
Valued Contributor

You can get idea to handle logparams looking at this

log params

lock Property

 

tristaanogre
Esteemed Contributor

IIRC, Unexpected windows are windows that open up that are modal in nature... in other words, you can't click "past" it on the components behind.  So... they are more like a pop-up coming from the application under test that is interfering with your test flow and you can't do anything without getting rid of it.

Overlapping Windows are more like, in the middle of the test, a MS Outlook notification pops up on screen and gets in the way of the test.  You can, technically, minimize it or drag it out of the way if you wanted to if you were a human user and continue working.

So... subtle differences which is why there are two different handlers.

Concerning something you mentioned at the top in the OP... I understand the convenience of having TC stop on any error... but I've found that it usually works better if I dictate when to stop... that way these unexpected halts don't happen and I can better control how things flow.


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
cancel
Showing results for 
Search instead for 
Did you mean: