4 days ago
i'm using "undetected_chromedriver".
this produces the timeouts:
driver = uc.Chrome(desired_capabilities=setCapabilities(), options=setChromeOptions())
driver.get(url)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=45733): Read timed out. (read timeout=120)
what am i missing here?
2 Replies
3 days ago
Hey, a-coutinho. Ensure your Chrome and ChromeDriver versions are compatible. Try downgrading to a known stable version pair (e.g., ChromeDriver 120 with Chrome 120).
You can try to add these arguments to your Chrome options before you create the Chrome driver instance. With undetected_chromedriver
, this is typically done as follows:
import undetected_chromedriver as uc options = uc.ChromeOptions() options.add_argument('--no-sandbox') options.add_argument('--disable-dev-shm-usage') options.add_argument('--disable-gpu') driver = uc.Chrome(options=options)
3 days ago
thanks for your reply. my code works well on my computer. i'm running windows10.
before the driver i already have this
options.add_argument("--FontRenderHinting[none]")
options.add_argument("--disable-background-timer-throttling")
options.add_argument("--disable-backgrounding-occluded-windows")
options.add_argument("--disable-crash-reporter")
options.add_argument("--disable-crashpad-for-testing")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-extensions")
options.add_argument("--disable-logging")
options.add_argument("--disable-modal-animations")
options.add_argument("--disable-renderer-backgrounding")
options.add_argument("--disable-setuid-sandbox")
options.add_argument("--no-sandbox")
options.add_argument("--proxy-bypass-list=*")
options.add_argument("--proxy-server='direct://'")
options.add_argument("--start-maximized")
options.add_argument('--allow-running-insecure-content')
options.add_argument('--blink-settings=imagesEnabled=false')
options.add_argument('--disable-browser-side-navigation')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-extensions')
options.add_argument('--disable-gpu')
options.add_argument('--disable-infobars')
options.add_argument('--disable-notifications')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--no-sandbox')
options.add_argument('log-level=3')
here's my dockerfile:FROM python:latest
ENV PYTHONUNBUFFERED True
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
RUN pip install --no-cache-dir -r requirements.txt
RUN apt-get update && apt-get install -y wget unzip && \
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt install -y ./google-chrome-stable_current_amd64.deb && \
rm google-chrome-stable_current_amd64.deb && \
apt-get clean
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]