screenshot when failure or error with selenium & python

332 views
Skip to first unread message

joesri

unread,
Sep 18, 2009, 3:22:31 PM9/18/09
to selenium-users...@googlegroups.com
Hi,

I am using selenium with python and using HTMLTestRunner for reporting.

I would like to have a screenshot taken when a test fails or errors out  also send the result as error or failure.  If I add a try/catch, since there is a catch, selenium reports it as passed and HTMLTestRunner shows everything as green eventhough the test failed.  Am I doing something wrong?  If not, how to handle this?

Is there a parameter, I can send to selenium in the catch to specify the case failed or errored out?

Thank you
Jo

Corey

unread,
Sep 19, 2009, 10:38:47 PM9/19/09
to selenium-users...@googlegroups.com
you can re-raise the exception after you catch and capture your screenshot.  just use 'raise' in your except block after you take the screenshot.

joesri

unread,
Sep 20, 2009, 2:14:51 AM9/20/09
to selenium-users...@googlegroups.com
Thannk you very much Corey!

Jo

Reply all
Reply to author
Forward
0 new messages