握手中缺少'marionetteProtocol'字段

时间:2017-03-19 21:26:04

标签: python selenium anaconda

不确定发生了什么。可能是因为我运行这个python脚本时可能没有最新版本的模块或错误。我收到以下错误:

WebDriverException                        Traceback (most recent call last)
<ipython-input-17-d1a8ab171ac2> in <module>()
      3 from selenium import webdriver
      4 
----> 5 driver = webdriver.Firefox()
      6 from selenium.webdriver.common.keys import Keys
      7 from bs4 import BeautifulSoup

//anaconda/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy, executable_path, firefox_options, log_path)
    153                 command_executor=executor,
    154                 desired_capabilities=capabilities,
--> 155                 keep_alive=True)
    156 
    157         # Selenium remote

//anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector)
     90         self.error_handler = ErrorHandler()
     91         self.start_client()
---> 92         self.start_session(desired_capabilities, browser_profile)
     93         self._switch_to = SwitchTo(self)
     94         self._mobile = Mobile(self)

//anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in start_session(self, desired_capabilities, browser_profile)
    177         if browser_profile:
    178             capabilities['desiredCapabilities']['firefox_profile'] = browser_profile.encoded
--> 179         response = self.execute(Command.NEW_SESSION, capabilities)
    180         if 'sessionId' not in response:
    181             response = response['value']

//anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.pyc in execute(self, driver_command, params)
    236         response = self.command_executor.execute(driver_command, params)
    237         if response:
--> 238             self.error_handler.check_response(response)
    239             response['value'] = self._unwrap_value(
    240                 response.get('value', None))

//anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.pyc in check_response(self, response)
    191         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    192             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 193         raise exception_class(message, screen, stacktrace)
    194 
    195     def _value_or_default(self, obj, key, default):

WebDriverException: Message: Missing 'marionetteProtocol' field in handshake

1 个答案:

答案 0 :(得分:0)

如果您使用的是Firefox 52,请确保您使用的是geckodriver 0.15和selenium 3.3 +