Closed owenpearson closed 4 years ago
Thanks for reporting this, @owenpearson. To debug issues like this, it helps to add dumpio: true
to the browser launch arguments, and see the underlying issue.
Typically this issue implies that the docker image is missing some system dependencies. I have a working version which uses Ubuntu 18.04 as a base image, that you might be able to refer to. Do you think you can use that instead? If not, I'll take this issue as a suggestion to add a recommended dockerfile setup for Alpine.
ah yeah, that will be it. i'm away from my workstation for today so i'll give it a try tomorrow. fortunately gitlab runner has support for bionic so hopefully i won't need a reccomended setup for alpine. thanks a lot 👍
I'm getting the same error when try to run inside a docker
(MiniBrowser:1413): Gtk-WARNING **: 19:12:49.058: cannot open display:
0| | ====> Error: Failed to launch browser!
0| | TROUBLESHOOTING: https://github.com/Microsoft/playwright/blob/master/docs/troubleshooting.md
0| | at onClose (/app/node_modules/playwright-core/lib/server/processLauncher.js:139:20)
0| | at Interface.<anonymous> (/app/node_modules/playwright-core/lib/server/processLauncher.js:132:
Dockerfile bionic
################################################
# Compile with:
# sudo docker build -t microsoft/playwright:bionic -f Dockerfile.bionic .
#
# Run with:
# sudo docker run -d -p --rm --name playwright microsoft/playwright:bionic
#
#################################################
FROM ubuntu:bionic
# 1. Install node12
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs
# 2. Install WebKit dependencies
# Install browser deps, starting with webkit
RUN apt-get install -y libwoff1 \
libopus0 \
libwebp6 \
libwebpdemux2 \
libenchant1c2a \
libgudev-1.0-0 \
libsecret-1-0 \
libhyphen0 \
libgdk-pixbuf2.0-0 \
libegl1 \
libnotify4 \
libxslt1.1 \
libevent-2.1-6 \
libgles2 \
libgl1 \
libvpx5 \
# for chromium
libnss3 \
libxss1 \
libasound2 \
# for firefox
libdbus-glib-1-2 \
libxt6
# 5. Add user so we don't need --no-sandbox in Chromium
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
&& mkdir -p /home/pwuser/Downloads \
&& chown -R pwuser:pwuser /home/pwuser
# 6. (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get install -y xvfb
How can I solve this?
My open browser method
const browser = await webdriver.launch({
headless: false,
dumpio: true,
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
});
Context:
Describe the bug
running playwright tests in a gitlab ci pipeline is causing an error for me. the gitlab ci runner runs commands inside a node:alpine docker container. i get the following output during
npm install
:but then when i get to running the tests i get an exception and the output like:
(similar for webkit and chromium)