-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Why locally it works fine and in the server im being detected by hcaptcha? #3839
-
I'm using asynchronous seleniumbase as an API, with docker and the same proxies locally and in the server:
using these scripts:
from seleniumbase.undetected import cdp_driver def start_xvfb_display(): global XVFB_DISPLAY if XVFB_DISPLAY is None: from xvfbwrapper import Xvfb XVFB_DISPLAY = Xvfb() XVFB_DISPLAY.start() logging.info("VIRTUAL SCREEN STARTED") async def get_webdriver_nd(proxy_data=None) -> cdp_driver.browser.Browser: logging.debug("Launching web browser with nodriver...") proxy = None if type(proxy_data) is dict and proxy_data != {}: server = proxy_data.get("server") username = proxy_data.get("username") password = proxy_data.get("password") if server and username and password: proxy = f"{username}:{password}@{server}" elif server: proxy = server start_xvfb_display() return await cdp_driver.cdp_util.start_async( proxy=proxy, browser_args=["--no-sandbox"] )
Like here:
#3833
It does not break anymore but the thing is that locally from Windows Subsystem for Linux (WSL) its working fine with docker + proxies +seleniumbase and on the aws EC2 server with docker + proxies + seleniumbase (same conditions) im being detected by hcaptcha, I mean, hcaptcha has a command to generate a token and inject it into the html, when I evaluate it locally (obviously automating it) it gets me a valid token and works extremely fine but on the server it appears me the captcha because Im detected as a robot and dont calculate me the token.
I think Im closer
Any recommendation?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 2 replies
-
If you're saying you can bypass hCaptcha locally with SeleniumBase via Docker, then I would be curious to see your Dockerfile and the script you used. As far as I know, Docker leaves a detectable fingerprint, making stealth automation from there unlikely. I was also under the impression that hCaptcha can't be bypassed, and therefore hCaptcha-bypass is unsupported.
Once you send over that info, I can improve capabilities, such as when running SeleniumBase from Linux servers.
Currently, there are working stealth abilities from GitHub Actions Linux servers. Eg:
Beta Was this translation helpful? Give feedback.
All reactions
-
This is my dockerfile:
FROM python:3.12-slim-bookworm # Set working directory WORKDIR /app # Install required system dependencies # dumb-init kill chrome zombie processes # xvfb for headful chrome # gnupg verify Chrome’s signing key RUN apt-get update && \ apt-get install -y --no-install-recommends \ wget \ gnupg \ xvfb \ dumb-init && \ rm -rf /var/lib/apt/lists/* # Add Google Chrome repository and install Chrome RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \ apt-get update && \ apt-get install -y --no-install-recommends google-chrome-stable && \ rm -rf /var/lib/apt/lists/* # Create user and set permissions RUN useradd --home-dir /app --shell /bin/sh chromeuser && \ chown -R chromeuser:chromeuser /app USER chromeuser # Create Chrome config path to avoid warnings RUN mkdir -p "/app/.config/chrome/Crash Reports/pending" # Copy Python requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY src ./ # Ports (adjust if necessary) EXPOSE 8191 # Default entrypoint and command ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["python", "-u", "/app/main.py"]
Beta Was this translation helpful? Give feedback.
All reactions
-
That didn't work for me from a cloned SeleniumBase folder.
Beta Was this translation helpful? Give feedback.