【发布时间】:2015-08-06 19:56:41
【问题描述】:
我可以访问 Google 以获取页面标题:
var casper = require('casper').create();
casper.start('http://google.com', function() {
this.echo(this.getTitle());
})
casper.run();
// "Google"
但由于某种原因,我无法访问 iTunes Connect 页面:
var casper = require('casper').create();
casper.start('https://itunesconnect.apple.com', function() {
this.echo(this.getTitle());
})
// Undefined
如何成功请求上述页面?
这是我目前得到的:
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: https://itunesconnect.apple.com/, HTTP GET
[debug] [phantom] Navigation requested: url=https://itunesconnect.apple.com/, type=Other, willNavigate=true, isMainFrame=true
[warning] [phantom] Loading resource failed with status=fail: https://itunesconnect.apple.com/
[debug] [phantom] Successfully injected Casper client-side utilities
[object Casper], currently at about:blank
[info] [phantom] Step anonymous 2/2: done in 66ms.
[info] [phantom] Done 2 steps in 86ms
【问题讨论】:
-
您使用什么版本的 PhantomJS?请注册
resource.error、page.error、remote.message和casper.page.onResourceTimeout活动 (Example)。可能有错误。 -
@ArtjomB。我将如何在
start()函数中应用上述内容?
标签: javascript phantomjs casperjs