小编고니고*_*니고니的帖子

selenium.common.exceptions.WebDriverException:消息:无效参数:无法识别的功能:使用 Selenium 和 ChromeDriver 77.0 的 chromeOptions

这是我的代码

from selenium import webdriver
driver = webdriver.Chrome('C:\chromedriver_win32\chromedriver')
driver.get('http://google.com')
Run Code Online (Sandbox Code Playgroud)

这是一条错误消息。

Traceback (most recent call last):
  File "D:/project/Python/TEST_selenium/chromedriver_test.py", line 16, in <module>
    driver = webdriver.Chrome(executable_path="C:\chromedriver_win32\chromedriver",chrome_options=chrome_options)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: unrecognized capability: chromeOptions
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚为什么在这个简单的代码中会出现错误。

这段代码在一个月前有效。但它现在不起作用。

我已经更新了 chrome 和 chrome 驱动程序,但这并不能解决问题。 …

python selenium google-chrome selenium-chromedriver selenium-webdriver

1
推荐指数
1
解决办法
2953
查看次数