diff --git a/undetectedChromedriver/chromedriver b/undetectedChromedriver/chromedriver index 36173fd..f65409f 100755 Binary files a/undetectedChromedriver/chromedriver and b/undetectedChromedriver/chromedriver differ diff --git a/undetectedChromedriver/getChromeDriver.sh b/undetectedChromedriver/getChromeDriver.sh index 7e378a2..63d8808 100644 --- a/undetectedChromedriver/getChromeDriver.sh +++ b/undetectedChromedriver/getChromeDriver.sh @@ -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 diff --git a/undetectedChromedriver/patchChromedriver.py b/undetectedChromedriver/patchChromedriver.py index b346c19..58367ca 100644 --- a/undetectedChromedriver/patchChromedriver.py +++ b/undetectedChromedriver/patchChromedriver.py @@ -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') diff --git a/undetectedChromedriver/pushSeleniumStandaloneUcImage.sh b/undetectedChromedriver/pushSeleniumStandaloneUcImage.sh index f7470db..3fe625f 100644 --- a/undetectedChromedriver/pushSeleniumStandaloneUcImage.sh +++ b/undetectedChromedriver/pushSeleniumStandaloneUcImage.sh @@ -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 diff --git a/undetectedChromedriver/seleniumChromedriverDockerfile b/undetectedChromedriver/seleniumChromedriverDockerfile index 8aa1f2a..a9e62bb 100644 --- a/undetectedChromedriver/seleniumChromedriverDockerfile +++ b/undetectedChromedriver/seleniumChromedriverDockerfile @@ -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