运行.py文件报错selenium.common.exceptions.WebDriverException: Message: invalid argument: unrecognized capa

======================================================================
ERROR: setUpClass (__main__.baidutest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "baiduq.py", line 13, in setUpClass
    self.driver = webdriver.Chrome()
  File "C:\python36\lib\site-packages\selenium-3.4.3-py3.5.egg\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\python36\lib\site-packages\selenium-3.4.3-py3.5.egg\selenium\webdriver\remote\webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\python36\lib\site-packages\selenium-3.4.3-py3.5.egg\selenium\webdriver\remote\webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\python36\lib\site-packages\selenium-3.4.3-py3.5.egg\selenium\webdriver\remote\webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "C:\python36\lib\site-packages\selenium-3.4.3-py3.5.egg\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
 

----------------------------------------------------------------------
Ran 0 tests in 1.576s

FAILED (errors=1)

 

自己的解决方法,先升级selenium版本,pip install -U selenium

再次运行.py文件,问题解决了

 

 

 

你可能感兴趣的:(selenium+python)