0
私はグローバル変数なぜ最初の配列項目が未定義になるのですか?
var URL = [];
を設定し、データ取得:
casper.then(function() {
// I get 19 links from this code
URL = this.evaluate(getURL);
// I can see i get the first link
console.log(URL[0] + '***************');
});
が、この関数の後に私のURLは、[0]未定義示しています。
// But this URL[0] shows the error that
casper.thenOpen("'" + URL[0] + "'", function() {
this.echo(this.getTitle());
});
このようなエラー:
[debug] [phantom] opening url: 'undefined', HTTP GET
[debug] [phantom] Navigation requested: url=file:///Users/motogod19/PhantomPractice/parse_movie/'undefined', type=Other, willNavigate=true, isMainFrame=true
[warning] [phantom] Loading resource failed with status=fail: file:///Users/motogod19/PhantomPractice/parse_movie/'undefined'
なぜ?私はそれを理解することはできません。何か案は ?前もって感謝します。
あなたの 'evaluate'はおそらく何も返しません。 – Vaviloff
それは確かにデータがあります。私は解決策、返信のおかげで見つける。 –