简体   繁体   English

木偶驱动程序(Python)拒绝连接

[英]Connection refused with marionette driver (python)

I'm trying to run a web scraping script from cron. 我正在尝试从cron运行Web抓取脚本。 Using the selenium firefox it runs 6 times then crashes. 使用硒火狐浏览器运行6次然后崩溃。 I've raised a query on this but no one has even made a comment in a day so following some reading I thought I would try marionette. 我对此提出了疑问 ,但是一天都没有人发表评论,因此在阅读后我认为我会尝试木偶。

I've followed the basic tutorial but I'm getting the following Traceback: 我已经遵循了基本教程,但是获得了以下Traceback:

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

This is happening here: 这是在这里发生的:

driver = Marionette('localhost', port=2828)
driver.start_session()

I am running this on a Ubuntu 16 server without a display from the command prompt at this stage. 我现阶段在Ubuntu 16服务器上运行此程序,而没有从命令提示符显示此内容。 My firefox version of the script is using pyvirtualdisplay to emulate the display and I left that in. I don't know if this is the issue? 我的脚本的Firefox版本正在使用pyvirtualdisplay来模拟显示,我将其留在了里面。我不知道这是问题吗?

Any help most welcome. 任何帮助最欢迎。

我使用此链接解决了问题,这是我最初的问题(我尝试此路线是因为遇到了麻烦)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM