How to make Chrome (Selenium Hub) undetectable?

252 Views Asked by At

I am using Selenium Grid with hub and node-chrome docker images configured in this way:

version: '3.8'

services:
  hub:
    image: selenium/hub:4.15.0
    ports:
      - 4442:4442
      - 4443:4443
      - 4444:4444
    environment:
      GRID_MAX_SESSION: 8     

  chrome_node_1:
    image: selenium/node-chrome:4.15.0
    depends_on:
      - hub
    environment:
      SE_EVENT_BUS_HOST: hub
      SE_EVENT_BUS_PUBLISH_PORT: 4442
      SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
      SE_NODE_MAX_SESSIONS: 2
      SE_NODE_STEREOTYPE: "{\"browserName\":\"chrome\",\"browserVersion\":\"119\",\"platformName\": \"Windows 10\"}"

and this is my relevant python code:

from selenium import webdriver
from bs4 import BeautifulSoup

options = webdriver.ChromeOptions()
options.add_argument('--disable-dev-shm-usage')

driver = webdriver.Remote(
    command_executor="http://<HUB_IP>:4444/wd/hub",
    options=options
)
driver.get('https://nowsecure.nl/')
import time; time.sleep(10)
driver.close()

but a CF challenge is requested.

I know there is the undetected-chromedriver python lib but I did not understand how to patch the chromedriver using selenium grid or if there is a way to make it undetectable in other ways.

0

There are 0 best solutions below