Skip to content

[Bug]: AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright' #999

@KotlinIsland

Description

@KotlinIsland

Playwright version

1.16.1

Operating system

Windows 10

What browsers are you seeing the problem on?

No response

Other information

python 3.10.0

What happened? / Describe the bug

I see AttributeError sometimes when I run playwright.

Code snippet to reproduce your bug

from playwright.sync_api import sync_playwright

for i in range(10000):
    print(i)
    with sync_playwright() as p:
        pass

Relevant log output

Traceback (most recent call last):
  File "...\scratches\scratch_1.py", line 4, in <module>
    print(i)
  File "...\venv\lib\site-packages\playwright\sync_api\_context_manager.py", line 71, in __enter__
    playwright = self._playwright
AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions