These are chat archives for rosshinkley/nightmare

13th
Apr 2017
Andrew Guenther
@AndrewGuenther
Apr 13 2017 00:16
Curiosity question, why does Nightmare use Electron rather than communicating with a Chrome instance via the debugging protocol (through https://github.com/cyrus-and/chrome-remote-interface for example)
johnferro
@johnferro
Apr 13 2017 14:02
@AndrewGuenther From my understanding (I wasn't using it then) nightmare started out using phantomjs and then switched to electron. I'd assume this switch was more straightforward than switching to chrome. The biggest reason might have been because both phantomjs and electron support a headless mode while chrome did not
Although that could be something to discuss now that chrome headless is becoming a thing
tongtwist
@tongtwist
Apr 13 2017 14:38
Hi there. Is it possible to have some kind of interactivity in nightmare scripts?
browser.goto(url).if(predicate, then(browser), else(browser)).end()
something like that
@rosshinkley : what do you think about that?
tongtwist
@tongtwist
Apr 13 2017 14:56
Or maybe an optional argument to not release the electron process when calling end()
if the process survive to end(), i could enqueue others operations based on the result of any evaluate() call
tongtwist
@tongtwist
Apr 13 2017 17:08
Ok, response to myself: it's possible to return different promise in a then() function, and then to have a if-then-else pattern
Ilya Borovitinov
@icehaunter
Apr 13 2017 21:06
Hey guys, new user here. Is it possible to duplicate all page console.log to my node console?

I tried

nightmare
.on('console', function (type, args) {
    console.log('test')
    // console.log(`${type}`, args)
})

and it didn't seem to work

Doesn't even print 'test'
Ilya Borovitinov
@icehaunter
Apr 13 2017 21:39
Ok, it works
Ilya Borovitinov
@icehaunter
Apr 13 2017 21:53
Another question. Is there any way I could pass preload script any info?