These are chat archives for rosshinkley/nightmare

16th
Dec 2016
Mike Ackerman
@mackermedia
Dec 16 2016 15:39
any fresh ideas on :point_up: / segmentio/nightmare#555 are welcome ;)
Ross Hinkley
@rosshinkley
Dec 16 2016 15:42
work is finally starting to quiet down... if i don't have time today, i should have time this weekend to dig into it
Mike Ackerman
@mackermedia
Dec 16 2016 15:42
excellent! :+1:. I'm hoping to find some free time to spend trying to fix some of those issues I encountered yesterday as well
Ross Hinkley
@rosshinkley
Dec 16 2016 15:43
right on :)
looking forward to it
johnferro
@johnferro
Dec 16 2016 19:00

I tried to recreate with the following script but couldn't get it to hang, both images were created successfully, and the 'electron halted' log message showed up with both node and all electron processes stopped at the end. Ran it using xvfb-run -a --server-args="-screen 0 1920x1080x24" node test.js.

var Promise = require('es6-promise').Promise;

var test = [1,2];

var electronPath = require('electron-prebuilt');
var Nightmare = require('nightmare');


var page = Nightmare({
  waitTimeout: 60000,
  gotoTimeout: 60000,
  electronPath: electronPath,
  show: false,
  frame: false,
  width: 800,
  height: 600,
});

var setup = page.goto('https://www.google.com').wait(1000);

setup.then(() => {
  return test.reduce((promise, id) => {
    return page
      .wait(100)
      .evaluate(function (id) {
        return {
          x: Math.round(document.body.offsetWidth / 4),
          y: Math.round(document.body.offsetHeight / 4),
          width: 300,
          height: 400,
        };
      }, id).then((rect) => {
        return page.screenshot('/tmp/g' + id + '.png', rect);
      });
  }, Promise.resolve());
}).then(() => {
  return page.end();
}).then(function () {
  console.log('electron halted');
}).catch(function (e) {
  console.log('there was an error');
  console.log(e);
});

I'm on nightmare=2.7.0andelectron=1.3.4`. Happy to test any setting modifications to make it more similar to your setup, and if I get a chance later I will try with the newer nightmare/electron version.

Ross Hinkley
@rosshinkley
Dec 16 2016 19:05
mmm, curious to see with a more recent version of electron
that makes me raise a brow
johnferro
@johnferro
Dec 16 2016 21:12
tested it and saw it working for both (nightmare=2.7.0/electron=1.4.4) and (nightmare=2.8.1/electron=1.4.4)
although to add another variable I'm on node 4.4.3
johnferro
@johnferro
Dec 16 2016 21:24
Tried (nightmare=2.8.1/electron=1.4.4/node=6.9.2) and it still worked
Ross Hinkley
@rosshinkley
Dec 16 2016 21:25
hm
color me surprised
johnferro
@johnferro
Dec 16 2016 21:26
Yeah, I know I've had some problems with different versions not playing well with each other in the past which is why it was my leading theory
Ross Hinkley
@rosshinkley
Dec 16 2016 21:27
same
johnferro
@johnferro
Dec 16 2016 21:34
I have seen some problems with the versions only happen on certain websites as well though so that could be one difference between my script and what's going on for @mackermedia
Mike Ackerman
@mackermedia
Dec 16 2016 22:11
ah, thanks for investigating @johnferro . I was planning on trying your script in my environment
johnferro
@johnferro
Dec 16 2016 22:16
Sounds good! If you get the chance try it with the website that you're using as well
Mike Ackerman
@mackermedia
Dec 16 2016 22:24
@johnferro that seems to work in my environment. the only difference was not using electron-prebuilt
johnferro
@johnferro
Dec 16 2016 22:25
hmmm with the website change as well?
Mike Ackerman
@mackermedia
Dec 16 2016 22:51
will test momentarily
need to pass session values to avoid needing to OAuth
coyotte508
@coyotte508
Dec 16 2016 22:55
Hmm I don't suppose there's an easy way to use .type on a field inside an iframe? (or even have nightmare set the iframe as reference / ....)