March 28, 2025

ikayaniaamirshahzad@gmail.com

Playwrite – Basics – DEV Community


_How to Install _

  • pip install pytest-playwright
  • playwright install

How to run a program

  • If the file name starts without test*.py then just use this command. ex: file name myusecase.py
$ pytest <>.py
$ pytest myusecase.py
Enter fullscreen mode

Exit fullscreen mode

  • If the file name starts with test<>.py then no need to specify the file name when running
$ pytest
Enter fullscreen mode

Exit fullscreen mode

  • If you want to see the execution in a browser.
$pytest --headed --browser firefox 
Enter fullscreen mode

Exit fullscreen mode

  • Record the flow and copy the code
$playwright codegen https://example.com
Enter fullscreen mode

Exit fullscreen mode

Playwrite Documentation: https://playwright.dev/python/docs/actionability



Source link

Leave a Comment