[Bug]: Playwright test cases failing in Linux Alpine
See original GitHub issuePlaywright version
master commit
Operating system
Linux
What browsers are you seeing the problem on?
No response
Other information
Java -> openjdk11 OS -> Linux Alpine
What happened? / Describe the bug
No test case is running inside Linux Alpine Image. The error is thrown while creating Playwright object (Playwright playwright = Playwright.create(options)
) . It looks like the Java process (https://github.com/microsoft/playwright-java/blob/master/playwright/src/main/java/com/microsoft/playwright/impl/PlaywrightImpl.java#L40) is unable to find the node executable in Linux environment.
On further checking it was found that the UNIX executable was indeed present at the location. Is Java playwright incompatible with Alpine image?? [We have also disabled browser installation through playwright]
Code snippet to reproduce your bug
apk add maven
apk add openjdk11
apk add curl
pk add unzip
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
mkdir /tmp/pw-java
Copy code base to /tmp/pw-java
cd /tmp/pw-java
./scripts/download_driver_for_all_platforms.sh
mvn install
Relevant log output
[ERROR] /tmp/playwright-java-17845343579725696111/playwright.sh: line 3: /tmp/playwright-java-17845343579725696111/node: not found
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How do I debug "Error: spawn ENOENT" on node.js?
You are explicity passing an env object to spawn on the options argument. In both scenarios, you must inspect the PATH key on...
Read more >Run your Playwright E2E Tests in GitLab CI | by Valentin Despa
One of the reasons why your tests may be failing is due to an inaccessible server URL, like localhost. Quite often, we deploy...
Read more >Robot Framework test case fails with “Element not found ...
Robot Framework test case fails with “Element not found” when running selenium library based test case with headless chrome inside a DOCKER container....
Read more >Troubleshooting - Chrome Developers
Make sure all the necessary dependencies are installed. You can run ldd chrome | grep not on a Linux machine to check which...
Read more >How to set up a Headless Chrome Node.js server in Docker
There are also countless use cases for website crawlers and ... getting Chromium for Linux and libraries required to run chrome for Alpine....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Did you try
playwright.cli.dir
that I mentioned above? It should give you what you want. Instead of having the driver extracted into a temp dir line/tmp/playwright-java-17487154887695204898
you’d extract/copy it manually into a directory, replace node.js with a binary that works on Alpine and leave js files intact.Thanks a lot! This worked 😃