phantomjs 和 run-jasmine.js 超时
所以我有一个奇怪的问题。
我在我的机器上本地运行了一个 Jasmine 测试运行程序,地址为 localhost:8080/test/runner.html
当我在网络浏览器中打开它时,它运行得很好。
我想自动执行此操作,因此我使用 phantomjs(从brew 安装 - 我在 Mac 上),并使用代码中的示例 run-jasmine.js 文件。
但是,每当我针对 URL 运行它时,我都会得到以下信息:
phantomjs war/test/spec/run_jasmine.js http://localhost:8080/test/runner.html
'waitFor()' timeout
因此,我编写了一个非常简单的脚本来查看是否缺少某些内容:
var page = require('webpage').create();
page.open(phantom.args[0],
function(status) {
if (status !== "success") {
console.log("Unable to access network");
phantom.exit();
} else {
if (document.body.querySelector('#hello')) {
console.log('hi');
}
}
});
并创建了一个新的 HTML 文件:
<!DOCTYPE html>
<html>
<head>
<title>hi</title>
</head>
<body>
<div id="hi"></div>
</body>
</html>
并且该内容仍然永远挂起。
我在这里错过了什么吗?我知道页面正在加载,但 phantomjs 看起来并没有解析它。
So I've got an odd issue.
I've got a Jasmine test runner running locally on my machine available at localhost:8080/test/runner.html
When I open it in a web browser it works perfectly.
I wanted to automate this so I'm using phantomjs (installed from brew -- I'm on a mac) and I'm using the example run-jasmine.js file from the code.
But, whenever I run it against the URL, I get this:
phantomjs war/test/spec/run_jasmine.js http://localhost:8080/test/runner.html
'waitFor()' timeout
So I wrote a really simple script to see if there is something I'm missing:
var page = require('webpage').create();
page.open(phantom.args[0],
function(status) {
if (status !== "success") {
console.log("Unable to access network");
phantom.exit();
} else {
if (document.body.querySelector('#hello')) {
console.log('hi');
}
}
});
And created a new HTML file:
<!DOCTYPE html>
<html>
<head>
<title>hi</title>
</head>
<body>
<div id="hi"></div>
</body>
</html>
And the thing still just hangs forever.
Am I missing something here? I know the page is being loaded, but it doesn't look like phantomjs is ever parsing it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我觉得很愚蠢。
/test/ 需要身份验证。
Well I feel dumb.
The /test/ requires authentication.