update undetected chromedriver with bigger session timeout

This commit is contained in:
2025-06-30 12:41:59 +02:00
parent 24629adcd5
commit c13c1db638
5 changed files with 27 additions and 8 deletions

Binary file not shown.

View File

@ -1,20 +1,32 @@
#!/bin/bash
# version variable
# Can be found here : https://hub.docker.com/r/selenium/standalone-chrome/tags
# Will need to change it in seleniumChromedriverDockerfile and probably download
# it and change it in patchChromedriver.py
VERSION="latest"
# From undetected chromedriver docker
#sudo docker run --rm -it -p 3389:3389 -v ./undetectedChromedriver:/root/.local/share/undetected_chromedriver/ ultrafunk/undetected-chromedriver:latest
sudo docker pull selenium/standalone-chrome:$VERSION
# With undetected chromedriver patcher
# Run the selenium/standalone-chrome:latest with a specific container name in the background
sudo docker run -d --name standalone-chrome selenium/standalone-chrome:latest
#sudo docker run -d --name standalone-chrome -v /home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chrome/:/opt/google/chrome/ selenium/standalone-chrome:$VERSION
sudo docker run -d --name standalone-chrome selenium/standalone-chrome:$VERSION
sleep 5
sleep 7
# Copy the chromedriver binary from the container to the host
sudo docker cp -L standalone-chrome:/bin/chromedriver ./chromedriver
# Stop the container
sudo docker stop standalone-chrome
sudo chmod 777 ./chromedriver
# Patch the chromedriver binary
source venv/bin/activate
python3 ./patchChromedriver.py
# Stop the container
sudo docker stop standalone-chrome
sudo docker rm standalone-chrome

View File

@ -4,5 +4,10 @@ import undetected_chromedriver as uc
options = uc.ChromeOptions()
# Chromedriver is in current directory
driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/google-chrome", driver_executable_path="/home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chromedriver")
# ERROR : This version of ChromeDriver only supports Chrome version xxx
# npx @puppeteer/browsers install chrome@xxx
# Change the path to the Chrome binary if needed
# "/home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chrome/google-chrome"
# "/home/ninluc/chrome/linux-124.0.6367.207/chrome-linux64/chrome"
driver = uc.Chrome(options = options, browser_executable_path="/bin/google-chrome", driver_executable_path="/home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chromedriver")
driver.get('https://nowsecure.nl')

View File

@ -1,4 +1,4 @@
#!/bin/bash
sudo docker build -f undetectedChromedriver/seleniumChromedriverDockerfile -t git.matthiasg.dev/ninluc/selenium/standalone-uc:latest .
sudo docker build -f seleniumChromedriverDockerfile -t git.matthiasg.dev/ninluc/selenium/standalone-uc:latest .
sudo docker push git.matthiasg.dev/ninluc/selenium/standalone-uc:latest

View File

@ -1,10 +1,12 @@
# FROM selenium/standalone-chrome:108.0 AS final
FROM selenium/standalone-chrome:latest AS final
FROM selenium/standalone-chrome:133.0-20250606 AS final
COPY undetectedChromedriver/chromedriver /bin/chromedriver
COPY ./chromedriver /bin/chromedriver
RUN mkdir -p /home/seluser/profile/
ENV TZ=Europe/Brussels
# 15 minutes session timeout
ENV SE_OPTS="--session-timeout 900"
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -s http://localhost:4444/wd/hub/status | jq -e '.value.ready == true' || exit 1