Generate HTML report using Playwright Python

Tutorial 19​​ ​​ Generate HTML report​​ using​​ Playwright​​ Python​​ 

What you will Learn​​ in this​​ blog:

  • Install pytest html plugin

  • Generate html report

  • Generate report within a folder

  • Generate report with error logs

Install pytest html plugin

Let us​​ first install pytest html plugin:​​ 
pip install pytest-html​​ 

Generate html report

Execute the command:

pytest -s -v --headed --html=pwreport1.html

The report gets generated

Open the report

Generate report within a folder

Let us introduce an error​​ in script

Execute the command. This time the report will get generated inside the folder ‘Reports’

pytest -s -v --headed ​​ --html=Reports/pwreport2.html

Right now if you observe​​ above, the report does not contain any error logs.

Generate report with error logs

Execute the command using​​ --capture​​ option

pytest -s -v --headed ​​ --html=pwreport3.html --capture=tee-sys

Open the report.​​ 

Notice this time that the error logs are visible

So this is how we can generate a simple html report.

Thank you for reading!

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 10000 RS/149 USD
Attend All Live courses in just 10000 rs / $149 - offer ends 25th April 2024