These are chat archives for rosshinkley/nightmare

15th
Nov 2016
Squiggie
@squiggie
Nov 15 2016 04:03
Is it possible to access nightmare.type from within a .then() function? I am doing some loops inside a .then function. Inside a loop, I need to get the amount of items and then populate an input box. I'm finding the # of items then trying to do nightmare.type(selector,value) and nothing happens. I'm 100% positive the selector is correct but I'm not sure if I'm accessing he instance of the nightmare browser correctly.
Rob Brackett
@Mr0grog
Nov 15 2016 05:47
@johnferro Do you need to keep the Nightmare window hidden but want document.hidden === false? Or something else? If so, the most sane solution is probably to position the window offscreen:
Nightmare({
    show: true,
    x: 10000,
    y: 0,
    enableLargerThanScreen: true  // this allows you to position beyond screen edges
})
  .goto('http://somewhere.com')
  .then(/* etc */)
There are more complicated solutions to actually override document.hidden/document.visibilityState, but they are super wonky and very prone to breakage if Electron ever changes how it does things.
johnferro
@johnferro
Nov 15 2016 15:20
Thanks for responding @Mr0grog. You are right the goal is to keep the actual window hidden but have document.hidden === false. I will try moving the window offscreen like you suggested. Thanks again!