Skip to content

Stuck in certificate selection #2390

Closed
Closed
@Ramonrune

Description

@Ramonrune

Hi!

I'am using selenium base to bypass one site. It works really well on my PC and on EC2/Virtual box. I'am creating a docker container for it, but when i run the code inside a container, it stucks in certificate selection part.

Here is a simple code:

pkcs12_file='file.pfx'
password="password"
install_certificate(pkcs12_file, password)

args ="--lang=pt-BR,"    
args += ' --verbose,'    
args += f"--load-extension={os.path.join(os.getcwd(), 'captcha_extension')}"
chromium_arg = '--auto-select-certificate-for-urls={"pattern":"*","filter":{}}' + args
driver = Driver(
    uc=True,
    headless=True,
    browser="chrome",
    chromium_arg=chromium_arg
)

driver.get("")
wait.until(EC.presence_of_element_located((By.CLASS_NAME, "sign-in")))
driver.find_element(By.CLASS_NAME, "sign-in").click()
driver.find_element(By.ID, "login").click() # Code stops here
print("Passed")

Here is my dockerfile:


FROM debian:bullseye-slim

# Install Chrome
RUN wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb \
  && apt-get install -y /tmp/chrome.deb \
  && rm /tmp/chrome.deb


# Update the package repository and install necessary packages
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip

RUN apt-get install libnss3-tools -y

RUN mkdir -p $HOME/.pki/nssdb

RUN mkdir -p  $HOME/etc/opt/chrome/policies/managed
COPY policies.json  $HOME/etc/opt/chrome/policies/managed/policies.json
RUN pip install requests

COPY entrypoint.sh /tmp/entrypoint.sh


COPY requirements.txt /tmp/

RUN pip install --requirement /tmp/requirements.txt
COPY main.py /main.py


ENTRYPOINT ["/bin/bash", "/tmp/entrypoint.sh"]

In the final part, there is a captcha too, which i use another solution to break (not on the above code).
Notice that policies.json is the following:
{
"AutoSelectCertificateForUrls": ["{"pattern":"*","filter":{}}"]
}

Any ideas about what is could be? Code runs easily on my pc, but in container it is stucked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP Modeworkaround existsYou can reach your destination if you do this...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions