1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] ImportError: cannot import name 'sync_playwright' from 'playwright.async_api'

Discussão em 'Python' iniciado por Stack, Setembro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I initially did

    pip3 install playwright
    playwright install


    Then tried uninstalling and reinstalling pip3 install pytest-playwright. I looked at other StackOverflow questions and none of them worked for me.

    Traceback (most recent call last):
    File "/Users/me/Desktop/userinterview-python/userinterview.py", line 1, in <module>
    from playwright.async_api import sync_playwright, Playwright
    ImportError: cannot import name 'sync_playwright' from 'playwright.async_api' (/opt/homebrew/lib/python3.11/site-packages/playwright/async_api/__init__.py)


    from playwright.async_api import sync_playwright, Playwright

    with sync_playwright as p:
    browser = p.chromium.launch(headless=False, slow_mo=50)
    page = browser.new_page()
    page.goto('google.com')

    Continue reading...

Compartilhe esta Página