【问题标题】:Is appcache not supported with selenium webdriver (JS implementation) using phantomjs?使用 phantomjs 的 selenium webdriver(JS 实现)不支持 appcache 吗?
【发布时间】:2014-04-01 06:56:14
【问题描述】:

我们正在使用 Selenium WebDriver 和 PhantomJS 对我们的单页应用程序运行黄瓜测试。我们最近实现了一个 appcache 清单,现在我们的 cukes 失败了。在我们的故障排除中,它似乎失败了,因为 phantomjs 不支持缓存清单。在查看 phantomjsdriver.log 时,我们发现协商的功能包含:

"applicationCacheEnabled":false

然后我们尝试设置所需的功能以启用它:

var webdriver = require('selenium-webdriver');

var hooks = function() {
  this.Before(function(callback) {
    var pBrowser = webdriver.Capabilities.phantomjs();
    pBrowser.set('applicationCacheEnabled', true);
    this.driver = new webdriver.Builder().withCapabilities(pBrowser).build();
  });

日志文件中的期望与协商功能表明它正在尝试设置但没有成功(而且我们的 cukes 仍然失败)。

SessionManagerReqHand - _postNewSessionCommand - New Session Created: c6f61520-b603-11e3-83b0-2b905be08819
GhostDriver - Main - running on port 63911
CONSTRUCTOR - Desired Capabilities: {"browserName":"phantomjs","applicationCacheEnabled":true}
CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.1","driverName":"ghostdriver","driverVersion":"1.0.3","platform":"mac-unknown-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}

有谁知道我们的方案是否不受支持,或者我们是否以错误的方式实现它?

【问题讨论】:

  • 找到了我的问题的答案。根据此源代码bit.ly/1mrRvaV的第47行,GhostDriver尚不支持。

标签: selenium-webdriver phantomjs ghostdriver


【解决方案1】:

根据http://bit.ly/1mrRvaV 源代码的第 47 行,GhostDriver 不支持期望功能与协商功能的特性。

【讨论】:

    猜你喜欢
    • 2014-07-31
    • 2018-01-20
    • 1970-01-01
    • 2015-01-24
    • 2012-03-19
    • 1970-01-01
    • 1970-01-01
    • 2017-09-11
    • 2016-08-07
    相关资源
    最近更新 更多