Skip to content

[BUG] Page.screenshot method hangs indefinitely  #28995

Closed
@mat926

Description

@mat926

System info

  • Playwright Version: v1.40.0
  • Operating System: All
  • Browser: Chromium
  • Other info: 32GB RAM

Source code

from playwright.sync_api import sync_playwright

print("Starting...")

with sync_playwright() as p:
    try:
        browser = p.chromium.launch(headless=False)
        page = browser.new_page()
        for index in range(10000):
            print("Iteration:", index)
            page.goto('https://google.com')


    except Exception as error:
        if page:
            print("Error: ", {error})
            page.screenshot(path='error.png', timeout=0)
            print("Took a screenshot")

  • I provided exact source code that allows reproducing the issue locally.

Link to the GitHub repository with the repro

Test file (self-contained)

Steps

  • Run the code
  • Wait until the for loop crashes at about 2000-3000 iterations

Expected

The for loop runs all the way through and not crash.
The page.screenshot runs normally.

Actual
At the 2652 iteration, a Timeout exception gets caught. Chrome gets an Out of Memory error.
The code hangs at the page.screenshot line and never completes.

Screenshot

image

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy