我正在尝试将实习生设置为在Windows7计算机上运行PhantomJS
从现在开始,我的设置如下:
演示测试root/unit/tests/phantom.js
define([
'intern!object',
'intern/chai!assert'
], function(registerSuite, assert) {
registerSuite({
name: 'PhantomTest',
'dummy': function () {
assert(true, "Works!");
}
});
});配置文件root/unit/intern.config.js
define({
proxyPort: 9000,
proxyUrl: 'http://localhost:9000/',
capabilities: {
'selenium-version': '2.30.0'
},
environments: [
{
browserName: 'phantom'
}
],
maxConcurrency: 3,
useSauceConnect: false,
webdriver: {
host: 'localhost',
port: 4444
},
// used here
loader: {
},
suites: [ 'unit/tests/phantom.js' ],
functionalSuites: [ /* 'myPackage/tests/functional' */ ],
excludeInstrumentation: /^tests\//
});通过在浏览器中运行此测试和配置,它就能正常工作。
要用PhantomJS运行实习生,我执行:
phantomjs --webdriver=4444和:
cd root
node node_modules\intern\runner.js config=unit/intern.config然后,运行Phantomjs的控制台返回:
[INFO - 2013-07-01T21:29:07.253Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 42ba5b50-e295-11e2-86f7-e331eb8b922d而另一个则输出以下消息,不带任何进一步的日志:
Defaulting to "runner" reporter
Listening on 0.0.0.0:9000
Initialised phantomjs 1.9.1 on windows-7-32bit有没有提示我错过了什么?
发布于 2013-07-02 10:55:42
这样做的原因是https://github.com/ariya/phantomjs/issues/10522;phantomjs使用的是一个非常老的没有Function.prototype.bind的JavaScriptCore版本。此时您最好的选择是改用geezer版本的实习生,它应该可以在这个旧环境中正常工作。
https://stackoverflow.com/questions/17414134
复制相似问题