2017-03-19 94 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+

相關問題