我们正在使用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();
});
日志文件中所需的vs协商功能表明它已尝试设置但未成功(我们的问题仍然失败)。
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"}}
有没有人知道我们的方案是否得不到支持,或者我们是否以错误的方式实施它?