You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue: I can't run my automation using the Browser Library in Docker within a WSL environment. I've tried multiple Dockerfiles and entrypoints, but they all return the same error. I receive a message stating that the Playwright process was not found on port XXXXX, preventing the automation from starting the test.
I found other people on the internet reporting the same error, and they never found a solution. I can't think of anything else to try. I've already tried Launch server, Connect server, and everything I could imagine, but I always get the same error message.
Locally, everything works perfectly. The problem starts when I try to set up my automation in Docker on WSL. I need the automation to run in Docker because I will use it in a pipeline.
I'm coming here because I believe this might be the only place where I can get help. I have a lot of experience with automation in pipelines, and I've never faced a challenge as difficult as this one.
First dockerfile
# Use a imagem base do robotframework-browser na versão 16.0.2
FROM marketsquare/robotframework-browser:16.0.2
WORKDIR /python/ui_test_automation
COPY . .
CMD ["bash"]
Second dockerfile:
FROM mcr.microsoft.com/playwright:v1.50.0-noble
# Update apt-get
USER root
RUN apt-get update
RUN python3 --version
RUN apt install -y python3-pip python3.12-venv
# Clean up
USER root
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV PATH="/home/pwuser/.local/bin:${PATH}"
ENV NODE_PATH=/usr/lib/node_modules
# Cache operations
USER root
RUN mv /root/.cache/ /home/pwuser/.cache || true
RUN chmod a+rwx -R /home/pwuser/.cache || true
# Switch to pwuser for the remaining operations
USER pwuser
# Print pip version
RUN pip3 --version
# Create venv and active it
RUN python3 -m venv /home/pwuser/.venv
ENV PATH="/home/pwuser/.venv/bin:$PATH"
RUN pip3 install --no-cache-dir --upgrade pip wheel
RUN pip3 install --no-cache-dir --upgrade robotframework robotframework-browser==19.3.0
RUN python3 -m Browser.entry init
RUN python3 -m pip install playwright
RUN playwright install
RUN rfbrowser init
WORKDIR /python/ui_test_automation
COPY . .
CMD ["tail", "-f", "/dev/null"]
My custom dockerfile:
FROM ubuntu:20.04
LABEL name="uiautomation"
ENV DEBIAN_FRONTEND=noninteractive
ENV DISPLAY=:99
ENV NVM_DIR=/root/.nvm
ENV PATH=$NVM_DIR/versions/node/v20.18.1/bin:$PATH
ENV TF_ENABLE_ONEDNN_OPTS=0
ENV TF_CPP_MIN_LOG_LEVEL=2
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
ENV PYTHONPATH="/usr/local/lib/python3.8/dist-packages:/usr/src/app"
ENV DBUS_SESSION_BUS_ADDRESS="unix:path=/run/dbus/system_bus_socket"
ENV XDG_RUNTIME_DIR=/tmp
ENV DEBUG=pw:api
#ENV ROBOT_FRAMEWORK_BROWSER_NODE_PORT=9222
# Update the package repository and install essential tools
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y \
python3-pip python3-dev python3-setuptools git build-essential \
libffi-dev libjpeg-dev zlib1g-dev libstdc++6 libgcc1 libopencv-dev \
alsa-utils libcups2 mesa-utils libxrandr2 fontconfig tzdata curl \
libssl-dev libx11-xcb1 libxcb-dri3-0 libxi6 libxtst6 libwoff1 libxss1 \
libasound2 libpangocairo-1.0-0 libatk-bridge2.0-0 libgtk-3-0 \
libxml2 libxslt1.1 libevent-2.1-7 libgstreamer-gl1.0-0 \
gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x \
libflite1 libwebpdemux2 libharfbuzz-icu0 libenchant-2-2 \
libsecret-1-0 libhyphen0 libdbus-glib-1-2 libxrender1 libpci3 \
libevdev2 \
libgles2 \
x11-utils \
libx11-6 \
notification-daemon \
dbus-x11 \
dbus \
sudo \
systemctl \
upower \
xvfb wget \
&& apt-get clean
# Install NVM and Node.js
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash \
# && . $NVM_DIR/nvm.sh \
# && nvm install 20 \
# && nvm use 20 \
# && nvm alias default 20
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get -y install nodejs
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
dpkg -i google-chrome-stable_current_amd64.deb || apt-get install -fy && \
rm google-chrome-stable_current_amd64.deb
RUN su
RUN echo "[D-BUS Service] \nName=org.freedesktop.Notifications\nExec=/usr/lib/notification-daemon/notification-daemon" > /usr/share/dbus-1/services/org.freedesktop.Notifications.service
RUN dbus-uuidgen > /etc/machine-id
# RUN sudo systemctl restart upower
RUN service dbus start
RUN Xvfb :99 -screen 0 1920x1080x24 &
# # Verify Node.js and npm
RUN node -v && npm -v
# # Upgrade pip
RUN pip3 install --upgrade pip
# #This is custom project dependencies with Robot, Browser and others
RUN pip3 install --no-cache-dir \
git+https://username:[email protected]/mycorporation/FIT/_git/UIAutomationCommons
RUN pip install playwright
RUN playwright install
RUN rfbrowser init
# Install Playwright and initialize Robot Framework Browser
# RUN npx playwright install chromium firefox \
# && rfbrowser init
# # Set the working directory
WORKDIR /python/ui_test_automation
# RUN chmod u+x /usr/bin/Xvfb
# # Copy source code to the container
COPY . .
ENV NVM_DIR=/root/.nvm
ENV PATH=$NVM_DIR/versions/node/v20.18.1/bin:$PATH
RUN rfbrowser init
# Command to run the automation script
CMD ["bash", "-c", "dbus-daemon --system --nofork --nopidfile & xvfb-run google-chrome --headless --no-sandbox --remote-debugging-port=9222"]
The text was updated successfully, but these errors were encountered:
I'm facing an issue: I can't run my automation using the Browser Library in Docker within a WSL environment. I've tried multiple Dockerfiles and entrypoints, but they all return the same error. I receive a message stating that the Playwright process was not found on port XXXXX, preventing the automation from starting the test.
I found other people on the internet reporting the same error, and they never found a solution. I can't think of anything else to try. I've already tried Launch server, Connect server, and everything I could imagine, but I always get the same error message.
Locally, everything works perfectly. The problem starts when I try to set up my automation in Docker on WSL. I need the automation to run in Docker because I will use it in a pipeline.
I'm coming here because I believe this might be the only place where I can get help. I have a lot of experience with automation in pipelines, and I've never faced a challenge as difficult as this one.
First dockerfile
Second dockerfile:
My custom dockerfile:
The text was updated successfully, but these errors were encountered: