设置PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY [英] setting PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY

查看:214
本文介绍了设置PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在Java程序中正确设置功能PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY,以便使用最新版本的Ghostdriver github 以及我安装的phantomjs版本(1.9.1)

I have difficulties setting the capability PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY in my Java program correctly in order to use the newest version of Ghostdriver from github together with my installed phantomjs version (1.9.1)

这是我在Java程序中所做的

Here is what I do in my Java program

DesiredCapabilities caps = DesiredCapabilities.phantomjs();
caps.setCapability(
    PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
    "/xxx/phantomjs-1.9.1-linux-x86_64/bin/phantomjs" );
caps.setCapability(
    PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY,
    "/xxx/ghostdriver/src/main.js");
WebDriver driver = new PhantomJSDriver(caps);

如果我未设置PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY,则硒驱动程序将正确启动,但是我的测试中出现了一些错误,这些错误本应该在ghostdriver的当前开发人员分支中得到修复.因此,我遵循了此建议,并设置了灵巧的github版本的ghostdriver.

The selenium driver starts correctly, if i do not set the PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY, but I get some errors in my tests that are supposed to be fixed in the current developer branch of ghostdriver. So i followed this advice and set up the cuttent github version of ghostdriver.

但是,现在出现以下错误:

However, now I get the following error:

[ERROR - 2013-07-12T10:22:36.897Z] GhostDriver - Main - Could not start Ghost Driver => {
  "message": "Could not start Ghost Driver",
  "line": 79,
  "sourceId": 140320571924032,
  "sourceURL": "/xxx/ghostdriver/src/main.js",
  "stack": "Error: Could not start Ghost Driver\n    at /xxx/ghostdriver/src/main.js:79",
  "stackArray": [
    {
      "sourceURL": "/xxx/ghostdriver/src/main.js",
      "line": 79
    }
  ]
}

我的问题是,有人知道如何解决此问题吗?我是否必须以某种方式更改ghostdriver的config.js才能使其工作?

My question is, does anyone know how to fix this? Must I change the config.js of ghostdriver somehow to make this work?

信息:我正在与此同时交叉发布到ghostdriver的github问题上.

Info: I am crossposting this also to the github issues of ghostdriver.

推荐答案

我发现,这仅适用于硒版本> = 2.33的预期效果.我更新了硒,解决了这个问题.

I turns out, that this only works as expected for selenium version >= 2.33. I updated my selenium and this fixed the issue.

这篇关于设置PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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