我似乎无法成功通过测试获得 PhantomJS。我试图将它集成到我的项目中,但在那之后我尝试只运行基本的 Angular Docs 示例并且我遇到了同样的问题。到目前为止我的步骤:
npm install -g phantomjs
phantomjs --webdriver=9515
// ... GhostDriver - Main - 在端口 9515 上运行protractor protractorConf.js
这是示例中的同一个文件,只有 browserName 和 seleniumAddress 端口已更改:
// An example configuration file.
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:9515',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'phantomjs'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['onProtractorRunner.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
}
};
我收到以下错误消息:
UnknownError: Error Message => 'Detected a page unload event; asynchronous script execution does not work across page loads.'
我在 github 上发现了这个问题,这似乎是相关的。我认为我已经对他们的brower-setup.md有了足够的了解,可以将其包含在我的一个beforeEach
函数中。然后我发现这里 ptor
只是包装了驱动程序。哇,我知道我是量角器/硒领域的菜鸟,但信噪比非常具有说服力。我真的很想获得使用 PhantomJS 的性能优势,但是为此多花几个小时的前景让我很头疼。我使用的是 Windows 7 Enterprise 64 位,以防万一。谢谢!