已安装正确的geckodriver,我已经用谷歌搜索了。在我的上一个Linux系统Debian上,相同的代码和python版本(3.6x)可以正常工作,并且我目前正在使用Peppermint OS。 使用chromedriver的效果和以前一样好。这是完整的错误消息。
SessionNotCreatedException Traceback (most recent call last)
<ipython-input-2-eeacfa5ccdaa> in <module>()
----> 1 driver = Driver.firefox()
~/path/to/env/lib/python3.6/site-packages/mymodule-py3.6.egg/common/selen.py in firefox(self, agent)
33 if os.environ.get("no_head"):
34 display = Display(visible=0, size=(800, 600)).start()
---> 35 driver = webdriver.Firefox(profile)
36 driver.implicitly_wait(20)
37 return driver
~/path/to/env/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy, executable_path, options, log_path, firefox_options, service_args, desired_capabilities)
168 command_executor=executor,
169 desired_capabilities=capabilities,
--> 170 keep_alive=True)
171
172 # Selenium remote
~/path/to/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
154 warnings.warn("Please use FirefoxOptions to set browser profile",
155 DeprecationWarning)
--> 156 self.start_session(capabilities, browser_profile)
157 self._switch_to = SwitchTo(self)
158 self._mobile = Mobile(self)
~/path/to/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities, browser_profile)
249 parameters = {"capabilities": w3c_caps,
250 "desiredCapabilities": capabilities}
--> 251 response = self.execute(Command.NEW_SESSION, parameters)
252 if 'sessionId' not in response:
253 response = response['value']
~/path/to/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
318 response = self.command_executor.execute(driver_command, params)
319 if response:
--> 320 self.error_handler.check_response(response)
321 response['value'] = self._unwrap_value(
322 response.get('value', None))
~/path/to/env/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
240 alert_text = value['alert'].get('text')
241 raise exception_class(message, screen, stacktrace, alert_text)
--> 242 raise exception_class(message, screen, stacktrace)
243
244 def _value_or_default(self, obj, key, default):
SessionNotCreatedException: Message: Unable to find a matching set of capabilities