我尝试使用phantomjs和节点进行测试,但我无法打开它。当我传递正确的URL时执行停止处理。代码在坏网址上执行。
如果服务器= http://localhost:3001
,则失败 如果服务器= http://localhost:3000 ,无法成功
phantom.create(function (ph) {
console.log('createPage');
ph.createPage(function (page) {
console.log('open');
page.open(server,function(status) {
console.log('Status: '+status);
if ( status !== "success" ) {
console.log('Unable to load '+ server) ;
ph.exit();
}
else {
console.log('success loaded wait for ready') ;
... ...
错误出现在grunt和buster
中grunt测试
但是
node test / node-test-index.js使用此堆栈跟踪执行代码
Status: success
success loaded wait for ready
other
'waitFor()' timeout
Uncaught exception in node v0.10.29, linux x64:
abnormal phantomjs exit code: 1
AssertionError: abnormal phantomjs exit code: 1
at Console.assert (console.js:102:23)
at ChildProcess.<anonymous> (/home/hebus/Documents/git/system/nodejs/searchEs/node_modules/phantom/phantom.js:153:28)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:809:12)
Running 1 tests in 1 runtime ... 100% done