0
Option = webdriver.ChromeOptions()
Option.add_argument('disable-infobars')
#Option.add_argument('--headless')
Option.add_argument('--log-level=3')
Option.add_argument('--disable-blink-features=AutomationControlled')
Option.add_argument('--allow-profiles-outside-user-dir')
Option.add_argument('ignore-certificate-errors')
Option.add_argument('--no-sandbox')
Option.add_argument("--proxy-server='direct://'")
Option.add_argument('--proxy-bypass-list=*')
Option.add_argument("--disable-dev-tools")
Option.add_experimental_option('excludeSwitches', ['enable-logging'])
Option.add_argument(f'user-data-dir=C:\\Users\\{user}\\FreeUse\\CASHER\\Profiles')
s = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=s, options=Option)
driver.get('https://casher2.win/games/wheel')
driver.maximize_window()

(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

How do I fix it and what did I do wrong?

kggn
  • 73
  • 1
  • 8
killua
  • 1
  • 1

1 Answers1

0

Remove the following arguments added through the instance of ChromeOptions() unless mandatory:

  • disable-infobars
  • --log-level=3
  • --disable-blink-features=AutomationControlled
  • ignore-certificate-errors
  • --no-sandbox
  • --proxy-server='direct://'
  • --proxy-bypass-list=*
  • --disable-dev-tools
  • excludeSwitches', ['enable-logging']

Additionally, you can replace --headless with --headless=new as headless property is deprecated, instead use add_argument('--headless') or add_argument('--headless=new')

Finally, incase you are using Selenium v4.6 or above you don't have to explicitly use ChromeDriverManager().install() anymore as Selenium Manager can silently download the matching ChromeDriver


Solution

Your minimal code block can be:

from selenium import webdriver

Option = webdriver.ChromeOptions()
Option.add_argument("--headless=new")
Option.add_argument('--allow-profiles-outside-user-dir')
Option.add_argument(f'user-data-dir=C:\\Users\\{user}\\FreeUse\\CASHER\\Profiles')
driver = webdriver.Chrome(options=Option)
driver.get("https://google.com/")
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352