TypeError: WebDriver.__init__() got multiple values for argument ‘options‘

selenium reports an error when calling chromedriver. It was available before. Today I upgraded selenium=4.11. After searching, it turns out that selenium 4.10 does not support the executeable_path parameter. You need to use the service parameter instead.

The relevant code needs to be modified as:

from selenium.webdriver.chrome.service import Service

chromedriver_path = "{}\chromedriver.exe".format(os.path.dirname(os.path.abspath(__file__)))  #指定chromedriver路径
chrome_options = webdriver.ChromeOptions()
driver=webdriver.Chrome(service=Service(chromedriver_path), options=chrome_options)

Guess you like

Origin blog.csdn.net/qq_43486538/article/details/132911809