In this session…
Difference between playwright and pytest-playwright
Can I install pytest-playwright after installing playwright
DEMO - Playwright with Pytest
After watching take this QUIZ and let me know your score in comments
https://forms.gle/g1utrHyVESrDtsYPA
GitHub Repo - https://github.com/Raghav-Pal/Playwri...
What is the difference
playwright
pip install playwright
Core Playwright API
This installs Playwright core (including browser automation API and bindings),
but not the pytest integration
Playwright with Pytest
pip install pytest-playwright
Adds pytest integration (fixtures, CLI support)
This installs the pytest plugin for Playwright:
Write tests using pytest structure (def test_...)
Use fixtures like page, browser, etc., without manually launching the browser
Easily run tests with pytest command
pytest is a testing framework for Python — it's used to write simple, scalable, and readable test cases
-
DEMO - Playwright with Pytest
Step 1 - Install playwright pytest plugin pip install pytest-playwright
Step 2 - Install browser binaries playwright install
This downloads Chromium, Firefox, WebKit for testing
Step 3 - Check installations playwright --version pytest --version pip list
pip show pytest-playwright
Step 4 - Create a sample test file test_sample.py
def test_example():
assert 1 + 1 == 2
Step 5 - Run and check pytest test_sample.py
-
What features & options do we get with pytest-playwright
✅ Built-in Fixtures
page, browser, context, etc. ready to use in test functions
✅ Automatic Browser Setup
No need to manually launch/close browser
✅ Trace, Video, Screenshot
Capture on failure with simple CLI flags
✅ CLI Options
Control headless/headed mode, browser, output paths, etc.
▬▬▬▬▬▬▬
Share with all who may need this
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬▬ USEFUL LINKS ▬▬▬▬
✅ ALL TUTORIALS - https://AutomationStepByStep.com/
---