CasperJS отправляет только последний элемент несколько раз из моего цикла for

CasperJS - это круто, но он не публикует на моем локальном хосте информацию о моих выводах на консоль.

casper.wait(5000, function () {
    casper.wait(1000, function () {
        casper.then(function(){
            for  (var i = 0 ; i < 10; i++) {
                var description = casper.fetchText(x('//*[@id="acDataId-local'+i+'"]/a')); //*[@id="acDataId-local0"]/a
                console.log(description);
                var target_date = casper.fetchText(x('//*[@id="dtDataId-local'+i+'"]/text()[1]')); 
                console.log(target_date);
                var target_location = casper.fetchText(x('//*[@id="veDataId-local'+i+'"]')); 
                console.log(target_location);

                console.log(i, description)

                casper.then(function () {

                    casper.open('http://localhost:1337/events', {
                        method: 'post',
                            data:   {
                            'description': description,
                            'target_date':  target_date,
                            'target_location':  target_location,
                        },
                        headers: {
                           "stuff":"stuff"
                        }
                    });
                });
            }
            this.echo('POST ' + i );
        });
    });
});


casper.run();

Console.log выводит именно тогда, когда я хочу, но он публикует только последний элемент. Я пытался добавить casper.wait в разных местах, но это не помогло!

Ответы на вопрос(1)

Ваш ответ на вопрос