Replies: 3 comments 5 replies
-
Hi @misotrnka , the xvfb is really necessary? You can just set the headless to True. Try this dockerfile: FROM python:3.11.0
# Install dependencies
RUN apt -y update
RUN apt install -y gnupg
RUN apt install -y wget
RUN apt install -y iproute2
RUN apt install -y wkhtmltopdf
RUN apt install -y libx11-xcb1
RUN apt install -y libdbus-glib-1-2
RUN apt install -y git
RUN apt install -y tini
# Install google chrome browser
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN wget -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_$CHROMEDRIVER_VERSION-1_amd64.deb
RUN apt install -y /tmp/chrome.deb
RUN rm /tmp/chrome.deb
# APP
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install --upgrade pip wheel
RUN pip install pydoll-python
COPY . /app/
ENV PYTHONPATH=/app
|
Beta Was this translation helpful? Give feedback.
-
Thank you @thalissonvs , but I don't think Xvfb is really the problem. The behaviour is the same when I run in headless mode without Xvfb. I've tracked the issue down to this so far:
Here's how it looks:
With the modified code, where I proceed when reached the "interactive" state (should be enough since I only need the DOM parsed), it will proceed to selecting an element on the page, but again the CDP protocol times out:
I haven't encountered this behavior on pages that do not linger in the "interactive" state and properly reach "loaded" within some reasonable time. However, there are many pages that will never be fully loaded for a number of reasons. So perhaps Pydoll should have a mechanism to detect whether the page loading actualy finished and don't rely on the page "loaded" state. Still however, running the selector on a document in "interactive" state SHOULD work afaik. So maybe there is some other problem with the CDP. Since this only happens when running in a container, I believe the issue is actualy somehow related to CDP communication. |
Beta Was this translation helpful? Give feedback.
-
@misotrnka Did you ever get this working? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm experimenting with Pydoll and I'm trying to make it run in a Docker container. I was able to start the Chrome browser with Xvfb, I'm able to ping it (via
browser._connection_handler.ping()
), but when I try to navigate somewhere (e.g.await page.go_to('https://www.example.com')
), it hits a time out with this:Is there anyone here that has experience with containerizing Pydoll apps? Is there any caveat that I'm not aware of?
Beta Was this translation helpful? Give feedback.
All reactions