Error message: Could not connect to the playwright process

After installing and initializing the browser library, I get an error message:

Calling method ‘_start_suite’ of listener ‘Browser’ failed: Could not connect to the playwright process at port 64784

The log shows:

internal/modules/cjs/loader.js:621
throw e;
^

Error: No valid exports main found for ‘c:\python37-32\lib\site-packages\Browser\wrapper\node_modules\playwright’
at resolveExportsTarget (internal/modules/cjs/loader.js:618:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:650:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:948:27)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.playwright (c:\python37-32\lib\site-packages\Browser\wrapper\index.js:85577:18)
at webpack_require (c:\python37-32\lib\site-packages\Browser\wrapper\index.js:20:30) {
code: ‘MODULE_NOT_FOUND’
}

Anybody got an idea?

Have you executed rfbrowser init ?

1 Like

Yes, unfortunately I have used the init command. :slight_smile:

I have the same issue when run the docker into our stg env. but success when docker run on my local machine

Ui.Test BAIDU 1 :: Writer: Ni Ming Created: 2021-07-01 comment: Create For …
==============================================================================
[ ERROR ] Calling method ‘_start_suite’ of listener ‘Browser’ failed: Could not connect to the playwright process at port 37699.
BAIDU_WEB [ ERROR ] Calling method ‘_start_test’ of listener ‘Browser’ failed: Could not connect to the playwright process at port 43703.
| FAIL |
Parent suite setup failed:
Could not connect to the playwright process at port 42929.
------------------------------------------------------------------------------
Ui.Test BAIDU 1 :: Writer: Ni Ming Created: 2021-07-01 comment: Cr… | FAIL |
Suite setup failed:
Could not connect to the playwright process at port 42929.

Also suite teardown failed:
Could not connect to the playwright process at port 50692.

1 test, 0 passed, 1 failed

Ui | FAIL |
1 test, 0 passed, 1 failed

Output: /test/testframework/output/output.xml
Log: /test/testframework/output/log.html
Report: /test/testframework/output/report.html

This usually means that you are missing Node side dependencies for the Python where you have Robot Framework and Browser installed. Because you have working setup, you could try to find out what is the difference in your environment and in the staging.

Hi Christian

I’m facing now something that looks exactly what you had. Would you like to tell me if you were able to solve your issue and if yes, how did you do it?

Solution at least for my case:

Windows Security (Windows 10) was blocking the access. So I followed this path:

Windows Security > Virus & threat protection > Ransomware protection > Allow an app through Controlled folder access > Add an allowed app, and then I added both Python and Playwright.

After that my test was able to use Playwright without issues.

Update: I have solved this issue by uninstalling the browserlibrary, and re-installing both the browser lib. and node.js