Docker Container: Could not connect to the playwright process at port

Whilst running tests using pabot in a Docker container whilst extending Browser library with a JavaScript module some failures occur due to not being able to connect to playwright process. See stack trace at the bottom.

Docker base image is marketsquare/robotframework-browser image.

Some tests do pass however this pass rate varies with each run. Pabot processes is set to 5. Chromium browser running headless.

No issues experienced when running locally with same setup and commands from IDE.

Any ideas as to what could cause this?

line 2: Initializing library ‘Browser’ with arguments [ jsextension=/home/pwuser/.local/lib/python3.8/site-packages//keywords/.js ] failed: Could not connect to the playwright process at port 54121.
Traceback (most recent call last):
File “/home/pwuser/.local/lib/python3.8/site-packages/Browser/browser.py”, line 745, in init
libraries.append(self._initialize_jsextension(jsextension))
File “/home/pwuser/.local/lib/python3.8/site-packages/Browser/browser.py”, line 779, in _initialize_jsextension
with self.playwright.grpc_channel() as stub:
File “/usr/lib/python3.8/contextlib.py”, line 113, in enter
return next(self.gen)
File “/home/pwuser/.local/lib/python3.8/site-packages/Browser/playwright.py”, line 139, in grpc_channel
playwright_process = self._playwright_process
File “/usr/lib/python3.8/functools.py”, line 967, in get
val = self.func(instance)
File “/home/pwuser/.local/lib/python3.8/site-packages/Browser/playwright.py”, line 57, in _playwright_process
self.wait_until_server_up()
File “/home/pwuser/.local/lib/python3.8/site-packages/Browser/playwright.py”, line 125, in wait_until_server_up
raise RuntimeError(
RuntimeError: Could not connect to the playwright process at port 54121.

We sometimes see this same problem in our CI environment too. Current we don’t have good solution for it, because root cause is unknown for us. If you can dig any information out from your system. Like is process actually running, is there something in the nix logs or something similar we would be greatly interested. Perhaps we can find something to solve the problem

1 Like