爲什麼download()在我的腳本中不起作用?爲什麼casperjs download()函數不起作用?
即使冗長,也無法下載並顯示無錯誤。
var casper = require('casper').create({
verbose: true,
logLevel: "debug",
pageSettings: {
webSecurityEnabled: false
}
});
casper.start('https://developer.android.com/sdk/index.html', function() {
var url = this.evaluate(function() {
var selector = '#win-tools';
return __utils__.findOne(selector).getAttribute('href');
});
this.download(url, 'apps/android-sdk.exe');
});
casper.run();
它應該工作,我不明白。
對不起。它不適合我。你有沒有嘗試下載一個更大的文件?我認爲phantomjs無法下載超過x秒。因爲我的連接速度可能比你慢,所以它不適用於我,但與你同在。 – user3064931
您嘗試下載的文件有多大?你可以改變[waitTimeout](http://casperjs.readthedocs.org/en/latest/modules/casper.html#onwaittimeout)和[stepTimeout](http://docs.casperjs.org/en/latest/modules/ casper.html#onsteptimeout)腳本如果超時。儘可能詳細地提供。 –