0

whenever I run this code ..

import undetected_chromedriver as uc
from selenium.webdriver.support.ui import Select
from webdriver_manager.chrome import ChromeDriverManager
from selenium import webdriver
from selenium.webdriver.chrome.service import Service

options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument("--log-level=3")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
s = Service(ChromeDriverManager().install())
driver = uc.Chrome(service=s, options=options)
driver.get(r"https://www.google.com")

it shows an error

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: goog:chromeOptions from invalid argument: unrecognized chrome option: excludeSwitches

and when I comment out options.add_experimental_option("excludeSwitches", ["enable-automation"]),

it shows another error..

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: goog:chromeOptions from invalid argument: unrecognized chrome option: useAutomationExtension

fardV
  • 198
  • 9
  • The first thing I would do is go to the [capabilities](https://chromedriver.chromium.org/capabilities) page and make sure you are using up-to-date option names and syntax. – JeffC Apr 04 '23 at 20:13
  • you don't get this error if you just use selenium – Ajeet Verma Apr 05 '23 at 03:45

0 Answers0