playwright: [BUG] page.pause() does not stop

Context:

  • Playwright Version: 1.20.1
  • Operating System: Win 10 pro
  • Node.js version: 16.13.1
  • Browser: Chromium

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:

await this.page.pause()

Describe the bug

page.pause() stopped stopping and just steps forward, so no way to access the inspector and the recorder. No option changed, and been like this v18 I think. Is there an option to disable the pause() call?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 15 (7 by maintainers)

Most upvoted comments

using debugger doesn’t really replace page.pause because it’s effectively the exact same as a breakpoint. i use page.pause when i want to pause the execution without halting the event loop (ie. to work around issues like #10897 and #11668).

another use case is:

await page.route('**/foo*', async (route) => {
    const request = route.request()
    doSomethingWith(request) //BREAKPOINT HERE
})
await page.goto('https://google.com')
await page.waitForLoadState('networkidle')
await page.pause()

here, i want to pause execution once the site loads so i can manually poke around and hit the brekpoint in page.route once a matching request is intercepted. if i replace that await page.pause() with a debugger statement, i can’t do anything because navigation hangs until the event loop resumes

now i have to resort to something like await page.waitForTimeout(9999999) which isn’t ideal

Closing as per above since this behaviour is intentional. You can either use the VS Code debugger (or any other debugger) or the Playwright Inspector. Having both in parallel is contra productive.

I agree. It’s useful functionality, and not clear why remove it. You can name it something else, make it work when a flag is set, etc. Playwright is an excellent project from Microsoft, along with Vscode, but this feels like Windows 11 dropping the vertical talkbar. Some people like it that way… 😃