我想加載下面的網頁casperjs/phantomjs http://m.10bet.com/#leage_panel#10096。卡斯帕JS:奇怪的錯誤:狀態=失敗(HTTP 200)
所以我寫了下面的簡單腳本卡斯帕:
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
if(casper.cli.args.length != 1)
casper.echo('No URL as arguments given. Exiting.\n').exit();
var id = casper.cli.args[0]
casper.start('http://m.10bet.com/#leage_panel#' + id, function() {
casper.waitForResource("http://m.10bet.com/pagemethods.aspx/UpdateEvents", function() {
this.echo(casper.getPageContent())
}, function(){}, function(){}, 10000);
});
casper.run(function() {
this.echo('Done.').exit();
});
所以,我等着被加載這是在這種情況下,「http://m.10bet.com/pagemethods.aspx/UpdateEvents」最後的資源。我使用Chrome開發人員工具進行了檢查。隨後我想在控制檯上輸出呈現的html。
然而,而是在HTML我得到一個在我看來非常奇怪的錯誤:
solaris:js_loaders Tom$ casperjs 10bet_loader.js 10096
2014-01-03 17:31:36.545 phantomjs[8733:130b] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: http://m.10bet.com/#leage_panel#10096, HTTP GET
[debug] [phantom] Navigation requested: url=http://m.10bet.com/#leage_panel#10096, type=Other, lock=true, isMainFrame=true
[debug] [phantom] url changed to "http://m.10bet.com/#leage_panel#10096"
[debug] [phantom] Navigation requested: url=http://m.10bet.com/#leage_panel#10096, type=Reload, lock=true, isMainFrame=true
[warning] [phantom] Loading resource failed with status=fail (HTTP 200): http://m.10bet.com/#leage_panel#10096
[debug] [phantom] Successfully injected Casper client-side utilities
[debug] [phantom] url changed to "http://m.10bet.com/#leage_panel#10096"
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step 2/2 http://m.10bet.com/#leage_panel#10096 (HTTP 200)
[info] [phantom] Step 2/2: done in 761ms.
[info] [phantom] Step 3/3 http://m.10bet.com/#leage_panel#10096 (HTTP 200)
[info] [phantom] Step 3/3: done in 771ms.
[warning] [phantom] Casper.waitFor() timeout
[info] [phantom] Done 3 steps in 790ms
Done.
solaris:js_loaders Tom$
你可以從記錄錯誤「加載資源看,狀態未能=失敗(HTTP 200): http://m.10bet.com/#leage_panel#10096「給出了一個http 200正常但失敗。最終網頁不會被加載或打印在控制檯上。所以我想知道這裏出了什麼問題?
可能有一些與此有關:http://stackoverflow.com/a/26417660/2368834 順便說一句,希望你已經想通這麼多個月後:) :) – niftygrifty