0

I use Bahave and there is a next condition for after_scenario in environment.py

def after_scenario(context, scenario):
  if scenario.status == "failed":
    time_now = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")  
    context.browser.save_screenshot("failed_scenarios_screenshots/%s_%s_failed.png" % (scenario.name, time_now))

How can I add a made screenshot into json or html report?

Den Silver
  • 199
  • 16
  • You could convert it to [base64](https://stackoverflow.com/questions/3715493/encoding-an-image-file-with-base64). – kazbeel Jan 05 '18 at 11:54
  • do you need the image inline in the HTML file (in base64) , or as a separate png file ? – user803422 Jan 05 '18 at 12:42
  • yeap, I need the image inline in the HTML. And actually I will need it for cucumber report for Jenkins. So I need this attachment in json and then behave2cucumber converts json for appropriate cucumber report – Den Silver Jan 05 '18 at 13:17
  • @DenSilver - Did you find solution for the same? I am facing same issue. – Helping Hands Jan 01 '20 at 19:15

0 Answers0