1

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?

1 Answer 1

2

__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.

Sign up to request clarification or add additional context in comments.

2 Comments

It actually seems to be defined. Logging window.__pw_resume in the console shows a function. Do you mean that some internal state of this function/Playwright is not ready and that's why it doesn't work? If so, do you know which state it is so I can come up with a better solution to detect when it's ready?
Yes, __pw_resume is defined early, but the debugger environment isn’t fully initialized. There’s no official event or doc exposing when it’s actually ready, so a delay is still the most reliable workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.