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

How to extract text from a page into node context without using .then #1131

Closed
codeofsumit opened this issue May 10, 2017 · 1 comment
Closed

Comments

@codeofsumit
Copy link

So I'm building something like a "remote control" for a website. That means the nightmare instance/session stays open all the time.

If I launch the instance via goto and I do a couple of operations, somewhere down the line I want to extract information from the page.
But every time I use .evaluate().then() any chained methods to this instance after that are not executing. It seems like .then() requires an end() or expects it to be called.

Is there a way to get text from a page into the node context or can I call something on the instance after .then?

@codeofsumit
Copy link
Author

ok seems like it works when returning the nightmare instance inside the then callback

nightmare
  .evaluate(() => {
      return document.querySelector('.box_status td:first-child').innerText;
    })
    .then((text) => {
      console.log(text);
      return nightmare;
    })
   .click()

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