K
K
Konstantin2016-01-17 03:58:23
PhantomJS
Konstantin, 2016-01-17 03:58:23

How to load urls one by one from an array in casperjs?

I make a function on Casper, opened the page, pressed the button, displayed the result.
I'm testing on windows and I'm confused by the starting pause before loading / rendering the 1st page, the second one is loaded immediately.
I understand that he spends time on the start of the program.
I’m thinking about how to iterate through the array of urls that I will pass and open the page, click, display one by one

casper.start('стартовый урл', function (response) {
    var av = list.split(',');
    for (i=0; i< av.length; i++){
        this.echo(av[i]);
        this.thenOpen('https://url/'+av[i],function () {
            takeShot(); // делаю скриншот1
            this.click('a.a2');
            takeShot(); // делаю скриншот2
        });
 
    }
}

As a result, it first works out the echo - it displays a list of urls, and then it just starts loading pages there ...
there is no sequence ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question