Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

options parameter is not detected by ChromeDriverManager() in python

I try to use both webdriver and ChromeDriverManager at the same time including options but always it returns an error:
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install(), options=options)) TypeError: __init__() got an unexpected keyword argument 'options'

My code is:

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

options = webdriver.ChromeOptions()
# options = Options() # I used this line as well, but it did not work.
options.add_argument("start-maximized")
options.add_argument("--headless")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install(), options=options))
driver.get(url)

What should I do?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You have to call it like this:

driver = webdriver.Chrome( 
   service=Service(
        ChromeDriverManager().install()
    ),
    options=options
)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading