[Bug]: Not able to install Playwright in Docker on M1 with aarch64 architecture
See original GitHub issuePlaywright version
1.12.1
Operating system
MacOS
What browsers are you seeing the problem on?
Chromium
Other information
No response
What happened? / Describe the bug
Hi
I’m using playwright docker image here => https://hub.docker.com/_/microsoft-playwright
I encounter an issue where if I run playwright in the docker, I would have the below error
(node:97) UnhandledPromiseRejectionWarning: Error: Page closed
at CRSession.<anonymous> (/usr/local/lib/python3.8/dist-packages/playwright/driver/package/lib/server/chromium/crPage.js:341:60)
at Object.onceWrapper (events.js:420:28)
at CRSession.emit (events.js:326:22)
at /usr/local/lib/python3.8/dist-packages/playwright/driver/package/lib/server/chromium/crConnection.js:177:43
(node:97) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
It run fine in my own machine (macOS m1). I research and saw that it is related to browser.close too early. However, I’m using pytest and is using playwright as sync and not async function since pytest has fixture which can yield the page and then do a browser close later. E.g code below:
@pytest.fixture def page(): with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() yield page browser.close()
Do we. know why the same code run fine in my local machine but not in playwright docker?
Code snippet to reproduce your bug
No response
Relevant log output
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
@budsee As per the logs, on apple m1 the docker runs natively with arm64 but currently playwright only supports x86_64 on linux docker, if you want to run it currently then you need to emulate x86 with qemu.
Since the Python image is based on the upstream one, I will close this one here and we will track it upstream: https://github.com/microsoft/playwright/issues/7723