About Debugging While Testing with Playwright
By default, Playwright waits maximum 30 seconds for each element to be accessible. If you want to intercept the code for debugging with pdb
or PyCharm debugger, you likely need more time to inspect the values and step through the code execution. You can make the timeouts infinite with context.set_default_timeout(0)
as follows:
from playwright.sync_api import sync_playwright
playwright = sync_playwright().start()
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
context.set_default_timeout(0)
page = context.new_page()
page.set_viewport_size({"width": 1200, "height": 800})
...
Testing Debugging Django 5.x Django 4.2 Django 3.2 Python 3 PyCharm Playwright pdb
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.