Relative Content

Tag Archive for javascriptnode.jspuppeteer

How do I solve the error Protocol error (Runtime.addBinding): Cannot find execution context with given executionContextId?

I am trying to code a program in Node.js that uses puppeteer to click a button on a webpage that cause the browser to visit a new webpage and puppeteer has to click a button on the new page. Every time I run the code I get the error Exception has occurred: ProtocolError: Protocol error (Runtime.addBinding): Cannot find execution context with given executionContextId. When I set headless to false I see the code has no problem clicking the first button on the webpage but it encounters an error when trying to clicking the second one.

Puppeteer unable to click an element in iFrame while emulating mobile

Please take a look at the two Puppeteer scripts below.
Both of them are opening https://elarto.pl/logowanie, waiting 7 seconds for a pop-up window to appear and then trying to close the pop-up by clicking on the “X” icon (#edrone-onsite-popup-content > div > div > div:nth-child(2) in the edrone-onsite-popup-iframe iframe).

How to handle puppeteer waits efficiently?

The below code is working fine with the added delay of 75secs but that delay is not static, it changes according to the size of the file so I want to remove that delay and substitute that with a better solution.
After clicking on “Save & Continue” button, the page fetches data for 2-4 mins and then it clicks on the “Let’s start” button.

Web Scraping using node.js calling multiple pages

So I have this script in node.js using Puppeteer. Its supposed to go through a list of urls, and call a puppeteer function for each page (url)….It does work ,sorta but it seems like I could make this code much more optimized and just plain better. I just kinda had to force it all on one page, cause when I tried to modularize the scrape function to another script , it didn’t like it. Probably because I am not getting async like I probably should . I’m not asking for a lecture on async (but it would be appreciated if you were able to do it .). But I want to make this code look right if I was working in a shop I don’t feel this code would be the best way to do this plus the fact it doesn’t work reliably.