Forums

Chromedriver problem: __init__() got an unexpected keyword argument 'options'

Hi! when i want to use options in selenium with chromedriver (it was habilited for me) i get the error of the title. I would like to know if there is something i miss

My code:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from pyvirtualdisplay import Display


with Display():
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument("--headless")
        chrome_options.add_argument("--disable-gpu")
        driver = webdriver.Chrome(options=chrome_options)

Did you upgrade selenium to the most recent version?

I upgraded and works now, thanks!

Glad you got that working!