Open wnx3 opened 9 months ago
use hidemium.io
I'm talking about Undetected Chromedriver
use hidemium.io
I'm talking about Undetected Chromedriver
ud chromedriver is currently outdated
Yeah Chrome 117 Headless is currently being detected and haven't seen a fix yet :(
My workaround was downloading the portable version of Chrome 116, and then overriding the chrome executable path to chrome driver to 'GoogleChromePortable/App/Chrome-bin/chrome.exe'
Update: Apparently its just the User Agent that contains HeadlessChrome, so overriding the ua to something else will fix the issue.
So adding the normale Chrome user agent to the webdriver will also work, just add the UA to the driver options before starting the driver.
ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36'
options.add_argument(f'--user-agent={ua}')
Yeah Chrome 117 Headless is currently being detected and haven't seen a fix yet :(
My workaround was downloading the portable version of Chrome 116, and then overriding the chrome executable path to chrome driver to 'GoogleChromePortable/App/Chrome-bin/chrome.exe'
Update: Apparently its just the User Agent that contains HeadlessChrome, so overriding the ua to something else will fix the issue.
So adding the normale Chrome user agent to the webdriver will also work, just add the UA to the driver options before starting the driver.
ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' options.add_argument(f'--user-agent={ua}')
This helped, thank you!
@Helza , @andinua , could you modify the following docker file or provide a docker file for a container in which passing the cloudflare can be reproduced?
My try cannot reproduce the expected behavior:
# Dockerfile
FROM selenoid/chrome:116.0
USER root
RUN apt-get update || true
RUN apt-get install -y --no-install-recommends pip
RUN pip install undetected-chromedriver
RUN mkdir /test
WORKDIR /test
ENTRYPOINT ["python3", "test.py"]
with the modified test script from the documentation:
# test.py
from time import sleep
import undetected_chromedriver as uc
options = uc.ChromeOptions()
options.headless=True
ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36'
options.add_argument(f'--user-agent={ua}')
driver = uc.Chrome(version_main=116, headless=True, use_subprocess=False, options=options)
driver.get('https://nowsecure.nl')
sleep(5)
driver.save_screenshot('nowsecure.png')
and building the image and running the container:
docker build -t loc-ud-chrome-116 .
docker run --rm -v $PWD:/test loc-ud-chrome-116
Note: see #1600 for the remote version.
Do not bypass cloudflare with headless active after 117 update. Does anyone have any alternatives to resolve this?