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.

Evaluate returns undefined but chromium correctly has value inside evaluate

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.3.0
  • Platform / OS version: OS X Sierra 10.12.6
  • URLs (if applicable):
  • Node.js version: 8.10.0

What steps will reproduce the problem?

You can run this gist here: https://gist.github.com/chrisabrams/a2a098d1b2d697f349f4e1ad1be98602

What is the expected result? The expected result is that evaluate will return the list of nodes

What happens instead? Instead, evaluate returns undefined

Issue Analytics

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

github_iconTop GitHub Comments

17reactions
vsemozhetbytcommented, Apr 19, 2018

If I get this right, DevTools protocol cannot serialize an array of nodes and resolves it to undefined. If you make it an array of strings, this works:

return nodes.map(({ innerText }) => innerText)
14reactions
yanivefraimcommented, Apr 19, 2018

How about throwing an error when evaluate returns a non-Serializable value? cc @aslushnikov

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page.evaluate() returns undefined, but statement works in ...
I get the output as an object containing arrays of 10 items each in the devTools, but when I run it in the...
Read more >
Puppeteer documentation - DevDocs
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The Puppeteer API is...
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >
Introduction to using XPath in JavaScript - MDN Web Docs
This method evaluates XPath expressions against an XML based document (including HTML documents), and returns a XPathResult object, which can be ...
Read more >
Why does console.log() return 'undefined'? - Bits and Pieces
Thus after every bit of code you enter in the REPL is read, evaluated and ... /24342748/why-does-console-log-say-undefined-and-then-the-correct-value ...
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