How can i pass library argument to take screenshot when testcase fail

How can i pass browser library argument to take a screenshot when test case fail as on playwright
with example please

I found this argument but It doesn’t work
:label: run_on_failure=Take Screenshot \ fail-screenshot-{index}

Hi Tamer,

I noticed here “Importing” that the run_on_failure = is listed amongst the “Old deprecated argument order” list perhaps it’s already been removed in the more recent versions?

I guess the best option might be to use Register Keyword To Run On Failure after opening the browser with New Browser before New Context or New Page or before any test steps.

Hope that’s helpful,

Dave.

Browser library run on failure only works when Browser library keyword fails. Browser library run on failure functionality doesn’t care about the test status.

If you want to catch tests failure, then you need to examine in test status automatic variable in the test teardown and make it run the keyword you wanted.