2017-03-19 57 views
0

不知道发生了什么事情。这可能是我有一个错误,因为我运行这个python脚本时可能没有最新版本的模块或其他东西。我得到以下错误:在握手中缺少'marionetteProtocol'字段

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 

回答

0

如果你使用Firefox 52,确保您使用的geckodriver 0.15和硒3.3+

相关问题