我的python脚本出现了这个错误。我正在尝试无头地使用selenium firefox。有什么解决办法吗?在
Traceback (most recent call last):
File "myextractor.py", line 297, in <module>
testweb_myextractor.Run()
File "myextractor.py", line 80, in Run
self.driver.get(self.link_to_explore)
File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 213, in get
self.execute(Command.GET, {'url': url})
File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 199, in execute
response = self.command_executor.execute(driver_command, params)
File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 395, in execute
return self._request(command_info[0], url, body=data)
File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 425, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1048, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1088, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1044, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 888, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 850, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 831, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 111] Connection refused
要求:
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium import webdriver
//point to the location of firefox nightly binary = FirefoxBinary('C:\\Program Files\\Nightly\\firefox.exe', log_file=sys.stdout)
driver = webdriver.Firefox(firefox_binary=binary)
更多信息请访问:https://intoli.com/blog/running-selenium-with-headless-firefox/
看起来你的webdraver与浏览器不兼容。在
下载最新的Selenium WebDriver版本和Firefox ESR。它的稳定版本的mozilla没有更新。在
https://www.mozilla.org/en-US/firefox/organizations/faq/
它对你现在和将来都有帮助;)
相关问题 更多 >
编程相关推荐