Selenium webdriver issue: TypeError: WebDriver.__init__() got multiple values for argument 'options'

104 views Asked by At

I am using Selenium for Python as well as "webdriver_manager" library in my script. The webdriver_manager is automatically fetching the latest version of the CHROME webdriver whenever I run my script.

PLEASE NOTE: I want to resolve this issue WITHOUT DOWNGRADING SELENIUM VERSION

My code is as follows:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager

arg1 = r"--user-data-dir=C:\Users\asdcd\AppData\Local\Google\Chrome\User Data"
arg2 = r"--profile-directory=Profile 1"
arg3 = "disable-dev-shm-usage"
arg4 = "no-sandbox"
arg5 = "--disable-extensions"
arg6 =  "--remote-debugging-port=9222"

chrome_options = Options()
chrome_options.add_argument(arg4)
chrome_options.add_argument(arg1)
chrome_options.add_argument(arg2)
chrome_options.add_argument(arg3)
chrome_options.add_argument(arg5)
chrome_options.add_argument(arg6)
driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)

driver.get(google.com)

This is no longer working and it gives me the following error:

driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: WebDriver.__init__() got multiple values for argument 'options'

I have tried using Options instead of chrome_options as suggested by other posts, and I have tried commenting out all but 1 argument since the error message says it has multiple values for argument "options". None of these have resolved the issue

0

There are 0 answers