1

Is it possible to chain missions to spookyjs after initialization? Something like this:

Spooky = require('spooky');
var spooky = new Spooky({
    child: {
        transport: 'http'
    },
    casper: {
        logLevel: 'debug',
        verbose: true
    }
}, function (err) {
    if (err) {
        e = new Error('Failed to initialize SpookyJS');
        e.details = err;
        throw e;
    }

    spooky.start(
        'http://en.wikipedia.org/wiki/Spooky_the_Tuff_Little_Ghost');
    spooky.run();
});

spooky.thenOpen('http://google.com', function () {
    console.log('bla');
});

spooky.on('console', function (line) {
    console.log(line);
});

But when I do this I get this error:

TypeError: Object # has no method 'thenOpen'
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
someone235
  • 567
  • 2
  • 7
  • 21
  • You can put the `thenOpen` call directly behind the `start` call, but I guess you're asking something else. Why don't you describe your use case and what you want to achieve instead of showing some arbitrary limitation of spookyjs. – Artjom B. Jul 03 '15 at 12:58
  • I need to open a page in spookyjs, then run sum code outside spookyjs context, and then open another page. I don't want to re-initialize spookyjs for the mission, but use an existing process of phantomjs. – someone235 Jul 03 '15 at 13:06
  • Hi someone235, why don´t to the page calls within one spookyJS session- As Artjom mentioned, the thenOpen method will help you. – solick Jul 16 '15 at 14:52

0 Answers0