Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example doesn't work at all #803

Closed
spoike opened this issue Sep 23, 2016 · 2 comments
Closed

Example doesn't work at all #803

spoike opened this issue Sep 23, 2016 · 2 comments

Comments

@spoike
Copy link

spoike commented Sep 23, 2016

Trying to work through the example. But nothing really happens and it appears the Electron process never really starts judging by the debug output.

File:

const Nightmare = require('nightmare');
const nm = Nightmare({show: true});

nm
    .goto('http://yahoo.com')
    .type('input[title="Search"]', 'github nightmare')
    .click('.searchsubmit');

This is the DEBUG output:

$ DEBUG=* node index.js
  nightmare queuing process start +0ms
  nightmare queueing action "goto" for http://yahoo.com +2ms
  nightmare queueing action "type" +2ms
  nightmare queueing action "click" +0ms
  nightmare electron child process not started yet, skipping kill. +1ms

I'm running with the following:

  • MacBook Pro with OS X El Capitan (10.11.6)
  • Node 6.3.1, npm 3.10.3 (installed through nvm 0.29.0)

Same happens on nightmare versions 2.6.1 and 2.7.0.

@spoike
Copy link
Author

spoike commented Sep 23, 2016

I just realized the error. Nightmare doesn't run anything until you execute the run with:

  • yielding the chain (which needs to be inside a generator function)
  • having a .run() at the end of the chain
  • using .then() at the end of the chain

@spoike spoike closed this as completed Sep 23, 2016
@ghost
Copy link

ghost commented Nov 3, 2016

  • yielding the chain (which needs to be inside a generator function)
  • having a .run() at the end of the chain
  • using .then() at the end of the chain

This should go in the API docs in my opinion

Edit: Also worth adding .run expects a callback, leaving it empty will result in TypeError: Cannot read property 'apply' of undefined It took me way too long to realize that. And another piece of info being

.run() is really intended for internal use and usage isn't directly supported. Should it be?

from #501, also check out #575 for more info on that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant