using more than one run_on_failure keywords with Selenium2Library

1.1k Views Asked by At

I have noticed, that in Robot framework, I can't have both Log Source AND Capture Page Screenshot, when I define it in settings "run_on_failure". How do you workaround this, when you want to have both of them?

1

There are 1 best solutions below

0
On

You could create your own keyword that wraps the two keywords together, and use Register Keyword To Run On Failure to register it as the run on failure keyword.

*** Keywords ***

Failure Callback
    Capture Page Screenshot
    Log Source

And then call this before starting your tests, probably in your test/suite setup

Register Keyword To Run On Failure    Failure Callback

You could also expand Selenium2Library itself, in order to define your wrapper keyword and pass it directly when importing Selenium2Library as the run_on_failure argument.