我正在尝试从cron运行Web抓取脚本。使用硒火狐它运行6次然后崩溃。我raised a query就这个问题,但是没有人在一天之内做出评论,所以在读完之后我想我会尝试木偶。
我已经按照基本教程进行了操作,但是我得到了以下的回溯:
Traceback (most recent call last):
File "clint-selenium-firefox.py", line 52, in <module>
driver.start_session()
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/decorators.py", line 42, in _
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/marionette.py", line 1230, in start_session
self.protocol, _ = self.client.connect()
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/transport.py", line 213, in connect
self.sock.connect((self.addr, self.port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused
这发生在这里:
driver = Marionette('localhost', port=2828)
driver.start_session()
我在Ubuntu 16服务器上运行它,在此阶段没有显示命令提示符。我的firefox版脚本使用pyvirtualdisplay来模拟显示,我把它留在了。我不知道这是不是问题?
欢迎任何帮助。