These are chat archives for rosshinkley/nightmare

Dec 2016
Emil Shakirov
Dec 21 2016 18:38

Hi all!

I'm curious, is it possible to use generator functions with use()?

I want to something like this, but I wasn't able to make it work:

var Nightmare = require('nightmare');
var nightmare = Nightmare();

login(nightmare) {
  return nightmare
    // some login related stuff

var checkIfVerificationFormExists = function*(nightmare) {
  var exists = yield nightmare.exists("#some_selector");

  if (exists) {
    return nightmare.goto("/some-url")

  return nightmare;

Dec 21 2016 20:52
Part of the problem might be that the use function itself shouldn't be async but just returns a function that takes nightmare as its sole argument. See: