Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Why iterating through the map.entries would cause an error in Puppeteer?

It works well in passing primary variables and arrays to a js function in an evaluate method. But it can't work with a map.

color_map = new Map();
color_map.set("red",100);
color_map.set("white",200);
color_map.set("blue",300);
page.evaluate(function(color_map){ 
    for(const [key,value] of color_map.entries())
    {
        alert(value);
    }
// alert(color_map);
},color_map);

Puppeteer throws an error:

Evaluation failed: TypeError: color_map.entries is not a function or its return value is not iterable

Does puppeteer provide any api to achieve this? If no, I only can unzip the map to key and value lists and then pass them to evaluate function and then combine them in the evaluate function

I'm looking for an efficient approach. Thanks.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!