pythonplaywrightplaywright-python

How to automatically start the debugging session in Playwright?


I want to automatically start the debugging session instead of having it starting as paused. I found out that adding this code makes it work but it feels hackish to me:

context.add_init_script("setTimeout(window.__pw_resume, 500)")

Without the setTimeout, it won't work. Am I doing anything wrong?


Solution

  • __pw_resume isn’t defined immediately, so a short delay is needed.

    As of now, there’s no official setting to start unpaused, so this workaround necessary.