0

is there any possibility to continue with loading the next page from a URL List after a timeout occured?

Example:

casper.test.begin('TEST CONTROLLER', function(test) {

var navigation = [
  "http://www.url_1.com",
  "http://www.url_2.com",
  "http://www.url_3.com",
  "http://www.url_4.com"
];

casper.start().then(function(){

  /* Loop through all URLs so that all are visited  */
  casper.eachThen(navigation, (function(response){

    var actUrl = response.data;

      /* HERE THE NEXT PAGE IS LOADED */
      casper.thenOpen(actUrl).waitForUrl(actUrl, function () {

        /* Single tests for every resolution and link */
        casper.each(testfiles, function (self, actTest, i) {

          casper.then(function(){
            require('.' + testfiles[i]);
          });
        });
      }, function timeout() {
          casper.echo("\n==================\nTimeout:\n=================", 'WARNING');
          casper.test.fail("TIMEOUT");
          casper.clear();
        });
     ));
  })
  .run(function() {
    this.test.done();
  });
});

Let's assume the second page could not be loaded because of a timeout, how can i continue with the other sites from the array? Up to now i cannot do anything that continues it, it always stops with a timeout error.

Thanks in advice

aixellent
  • 45
  • 5
  • Have you tried to use [`casper.options.onStepTimeout`](http://docs.casperjs.org/en/latest/modules/casper.html#onsteptimeout) or [`casper.options.onWaitTimeout`](http://docs.casperjs.org/en/latest/modules/casper.html#onwaittimeout)? – Artjom B. Nov 04 '15 at 21:50
  • Hi Artjom, sorry for the late response, yes i initially initialised both Eventhandlers in several versions. At first i tried this approach here: http://stackoverflow.com/questions/20399453/casperjs-skip-step-on-timeout and the events were caught by the Handlers, thats okay, but i could not do anything to continue the running test, it always broke up with timeout error. – aixellent Nov 09 '15 at 08:02
  • Addendum: Please mark that i run the Testcycle in a ForEach Loop, maybe here are problem with the iterative stepping too. – aixellent Nov 09 '15 at 08:04

0 Answers0