我试图运行我在相当一段时间之前制造的刮板。它曾经工作得很好。我使我们由selenium
,geckodriver
和firefox
组成。我更新了所有内容。我在以下环境中运行刮板:
Python 3.5.6
Firefox 65.0.1 (64-Bit)
selenium 3.141.0
Geckodriver v.0.24.0
运行后
driver = webdriver.Firefox(gecko_path)
driver.get('https://duckduckgo.com')
print('Set proxy, set language.')
waitvar = input()
Firefox打开一个窗口,但出现错误:WebDriverException: Message: newSession
您将在下面找到整个错误消息。
我不知道为什么会出现此错误。我快速搜索发现其他用户通过更新到最新版本(我做到了)解决了该问题。任何想法如何解决这个问题?谢谢! / R
错误消息:
WebDriverException Traceback (most recent call last)
<ipython-input-3-b1d1332b7d5c> in <module>()
----> 1 driver = webdriver.Firefox(gecko_path)
2 driver.get('https://duckduckgo.com')
3 print('Set proxy, set language.')
4 waitvar = input()
/Users/RSleeps/anaconda/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy, executable_path, options, service_log_path, firefox_options, service_args, desired_capabilities, log_path, keep_alive)
172 command_executor=executor,
173 desired_capabilities=capabilities,
--> 174 keep_alive=True)
175
176 # Selenium remote
/Users/RSleeps/anaconda/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
155 warnings.warn("Please use FirefoxOptions to set browser profile",
156 DeprecationWarning, stacklevel=2)
--> 157 self.start_session(capabilities, browser_profile)
158 self._switch_to = SwitchTo(self)
159 self._mobile = Mobile(self)
/Users/RSleeps/anaconda/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities, browser_profile)
250 parameters = {"capabilities": w3c_caps,
251 "desiredCapabilities": capabilities}
--> 252 response = self.execute(Command.NEW_SESSION, parameters)
253 if 'sessionId' not in response:
254 response = response['value']
/Users/RSleeps/anaconda/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
319 response = self.command_executor.execute(driver_command, params)
320 if response:
--> 321 self.error_handler.check_response(response)
322 response['value'] = self._unwrap_value(
323 response.get('value', None))
/Users/RSleeps/anaconda/lib/python3.5/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):
WebDriverException: Message: newSession