Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taking screenshots on failure using Robot framework

I am new to robot framework. I want to know how to capture screenshots on failure. Doesnt robot framework automatically take screenshots if script fails? An example will be of great help!

like image 421
DISHA MUNSHI Avatar asked Oct 27 '25 07:10

DISHA MUNSHI


2 Answers

this is actually a feature of the Selenium2Library that would be required with Robot if you were doing Selenium based tests.

More information can be found here: http://robotframework.org/Selenium2Library/doc/Selenium2Library.html

As it says it the documentation, setting up screenshots on failure is very easy, for example here is mine from a test suite I'm working with:

Library    Selenium2Library  timeout=10   implicit_wait=1.5   run_on_failure=Capture Page Screenshot
like image 182
shicky Avatar answered Oct 29 '25 08:10

shicky


You can use the below keyword to capture screen shot after any of the step you want :

Capture Page Screenshot

Hope so this was helpful!

like image 37
Bahubali Patil Avatar answered Oct 29 '25 09:10

Bahubali Patil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!