question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Playwright test cases failing in Linux Alpine

See original GitHub issue

Playwright 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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yury-scommented, Aug 13, 2021

Can anyone state whether the above resolution makes sense ? Can we get an option for providing custom node.js path?

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.

0reactions
aarushiagcommented, Aug 13, 2021

Thanks a lot! This worked 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found