Selenium和PhantomJS错误:“无法连接到GhostDriver" [英] Selenium and PhantomJS Error: "Cannot connect to GhostDriver"

查看:184
本文介绍了Selenium和PhantomJS错误:“无法连接到GhostDriver"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Selenium和PhantomJS,以将搜索词输入网站,并检索每个搜索词的匹配数.我必须执行130,000次以上,因此代码已经运行了一天,直到程序突然中断并出现以下错误:

I am running Selenium and PhantomJS to input search terms into a website and retrieve the number of hits for each search term. I have to do this 130,000+ times, so the code has been running nicely for a day until suddenly the program broke with the following error:

Traceback (most recent call last):
  File "CBBPlyNwsScrape.py", line 82, in <module>
     browser = webdriver.PhantomJS()
  File "/Library/Python/2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 50, in __init__
     self.service.start()
  File "/Library/Python/2.7/site-packages/selenium/webdriver/phantomjs/service.py", line 69, in start
     raise WebDriverException("Can not connect to GhostDriver")
selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver' 

我正在Mac OSX和Python 2.7.3上运行它.我已经安装了Selenium和PhantomJS的最新版本.谁能告诉我这是怎么回事,为什么GhostDriver能够正常工作这么长时间并突然停止?

I'm running this on Mac OSX and Python 2.7.3. I have the latests versions of Selenium and PhantomJS installed. Can anyone tell me what is going on and why GhostDriver was working fine for so long and suddenly stopped?

ghostdriver.log文件中,它包含的全部内容:

In the ghostdriver.log file, this is all it contains:

PhantomJS is launching GhostDriver...
[ERROR - 2013-12-01T05:14:34.491Z] GhostDriver - Main - Could not start Ghost Driver => {
  "message": "Could not start Ghost Driver",
  "line": 82,
  "sourceId": 4445044288,
  "sourceURL": ":/ghostdriver/main.js",
  "stack": "Error: Could not start Ghost Driver\n    at :/ghostdriver/main.js:82",
  "stackArray": [
     {
        "sourceURL": ":/ghostdriver/main.js",
        "line": 82
     }
  ]
}

谢谢

推荐答案

安装最新的phantom js可以修复此错误,该问题是在默认的ubuntu 12.04 phantomjs destro上发生的

Installing latest phantom js fixed this error, this was happening with default ubuntu 12.04 phantomjs destro

这篇关于Selenium和PhantomJS错误:“无法连接到GhostDriver"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆