How to react on timeout

Hi,

We have quite a bunch of Robot Framework tests for our application. We experience random occurrences of failed tests. One of the scenario’s that occurs is that a pop-up is displayed in an overlay with a message that a general exception has occurred. There is a button on this pop-up to display the details.

What I would like to do is that I can start a keyword when a test fails because of a time-out. Because when this happens, I would like to be able to search for the modal pop-up and if it is available, I would like to expand the details and take a screenshot.

Would something like this be possible? Preferably without changing all the tests that we have but instead have this as a suite event or something like that.

Thanks in advance.

Björn

P.S. In addition I would like to have insights in the console logs, but as I read in some other threads this is a challenge on its own…

Hi Bjorn,

Maybe Wait For Alert is what you’re looking for?

Though you may want to use it a bit differently from the examples, but it looks more like what you are after than Handle Future Dialogs.

Dave.

Hi Dave,

I have been looking into the documentation for these keywords, but as I interpreted it, it is about browser alerts (like javascript alerts). In our situation it is an overlay Angular component which prevents links etc. from being visible / enabled.

Kind regards,
Björn

I think that what I’m looking for is Register Keyword To Run On Failure. I’ll have a look at that.

Hi Bjorn,

Yes you will probably need to combine them.

One question though, can you reproduce this dialogue manually?

The reason I ask is so you can check if the dialogue is actually a browser dialogue or a popup element in the html page (see if you can inspect it’s elements with dev tools).

If its a browser dialogue those keywords I mentioned are the only ones that can interact with it, if it’s in the html then they won’t help and you’ll need the standard Click, etc Keywords.

Dave.

Possibly helpful for your additional question, maybe this could be of interest: robotframework - How to read the web console output with robot framework and selenium? - Stack Overflow

Hi Daryl,

Thanks, but I thinkt that the ‘get_log’ only works when using the Selenium library.

Björn

Hi Dave,

In our scenario the pop-up is a model overlay in the HTML, so not a dialog from the browser. We will be able to handle this using the ‘Register Keyword To Run On Failure’ keyword.

Björn

Aha, that’s unfortunate, maybe worth a glance at this one:

Hi Björn,

Lucky you the HTML model overlays are easier and you can get more detail from them with the standard keywords.

Dave.

Hi Björn,

I just saw Browser Library has Get Console Log which may be useful.

Dave.

Hi Dave,

Your link to ‘Get Console Log’ doesn’t work for me. The only reference to the console that I can find in there is the documentation of ‘Close Page’.

Kind regards,
Björn

Hi Björn,

Interesting, it worked for me when I clicked it this morning.

Maybe it’s a new keyword and you need to refresh your browser cache for the Browser Library? (this is a guess) when I go to the top of the documentation the Library version is 16.0.0.

What makes me think it might be a new keyword is I actually picked up the link from this thread: Comments for Get Console Log

Dave.

Hi Dave,

You were spot on with your suggestion to refresh browser cache. I will use this in combination with ‘Register keyword to run on failure’ to try to get additional info when when our tests run into a problem situation.

Thanks!

Kind regards,
Björn