question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I'm having trouble working with the `evaluatePage` option

See original GitHub issue

**What is the current behavior? I’m having difficulty finding a way to get the text of the scraped page.

If the current behavior is a bug, please provide the steps to reproduce not a bug – just a question.

What is the expected behavior? being able to get the text from evaluatePage … but I don’t see it being executed.

What is the motivation / use case for changing the behavior? n/a

Please tell us about your environment:

  • Version:^1.6.0
  • Platform / OS version: high sierra / v10.13.4
  • Node.js version: │v9.10.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
OmarJAHcommented, May 8, 2018

If you need the full html you can go with this:

evaluatePage: (() => ({
    content: $('html').html()
})),

This will lead to the html code being saved in the “result.result.content” part of the overall “result” object, which you can use inside the onSuccess function:

onSuccess: (result => {
     console.log(JSON.stringify(result.result.content, null, 2));
     doAnalysisOnDynamicSourceCode(result.result.content);
 }),
2reactions
BubuAnabelascommented, May 8, 2018

You have to pass the selectors which you want to get from the HTML Document to the evaluatePage function. In the example above you are getting just the <title> text from the HTML Document. You could get the body or any other tag/selector just by doing the same as with the title.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer: page.evaluate not working after waitForNavigation ...
I run the script in debug mode ( node debug filename.js ), use sb(15) to set the breakpoint on line 15, press c...
Read more >
Adding a delay before evaluating page · Issue #150 - GitHub
Currently, evaluatePage is requested right after event specified in waitUntil option ("load" by default). What is the expected behavior?
Read more >
Cannot get my math operation to round - Page 2
It's in the "addOnUnload" function only right now. "Failed to evaluate page script in page Uncaught TypeError: Cannot read properties of null ( ......
Read more >
Rufaydium WebDriver 1.7.2 (no selenium/websocket) - Page 9
I just want to make sure ... Driver.exe runs and creates http server, I wonder what if driver takes time to create http...
Read more >
AutoML beginner's guide | Vertex AI - Google Cloud
Fortunately, machine learning is in a position to solve these problems. How does Vertex AI work? graphic representation of a simple neural network...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found