playwright-python: [BUG] Unable to run script past import

Context:

  • Playwright Version: 1.29.1
  • Operating System: Windows
  • Python version: 3.11
  • Browser: n/a

Code Snippet

from playwright.sync_api import Page, expect

from classes.pages.login.page_login import PageLogin


def test_login_successful_login(page: Page):
    username = "student"
    password = "Password123"
    # etc

Error encountered

Traceback (most recent call last):
  File "C:\Workspace\Testing\Test_Environment\main.py", line 1, in <module>
    from playwright.sync_api import Page, expect
  File "C:\Workspace\Testing\Test_Environment\venv\Lib\site-packages\playwright\sync_api\__init__.py", line 25, in <module>
    import playwright.sync_api._generated
  File "C:\Workspace\Testing\Test_Environment\venv\Lib\site-packages\playwright\sync_api\_generated.py", line 25, in <module>
    from playwright._impl._accessibility import Accessibility as AccessibilityImpl
  File "C:\Workspace\Testing\Test_Environment\venv\Lib\site-packages\playwright\_impl\_accessibility.py", line 17, in <module>
    from playwright._impl._connection import Channel
  File "C:\Workspace\Testing\Test_Environment\venv\Lib\site-packages\playwright\_impl\_connection.py", line 23, in <module>
    from greenlet import greenlet
  File "C:\Workspace\Testing\Test_Environment\venv\Lib\site-packages\greenlet\__init__.py", line 29, in <module>
    from ._greenlet import _C_API # pylint:disable=no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing _greenlet: The specified module could not be found.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Try pip install msvc-runtime

I installed greenlet 1.1.3 for playwright 1.30 and this is working with python 3.9

I will raise an issue with greenlet, pointing them here, but I suggest you guys also do the same as I don’t have any technical knowlege when it comes to the playwright, greenlet library or the differences between 3.9 and 3.11 (except for performance and switch case support)