Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Why locally it works fine and in the server im being detected by hcaptcha? #3839

juanfrilla started this conversation in General
Discussion options

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?

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

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:

You must be logged in to vote
2 replies
Comment options

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"]
Comment options

That didn't work for me from a cloned SeleniumBase folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /