Read out the waste calendar

true but this line has it covered :point_down:

await page.click('.bemCookieOverlay__btn--save');

@Wurmi
i dont know if you fixed the nvm problem yet but i did some tests on running puppeteer on my PI.
its an issue with their latest version (Github issue)
After a lot of reading what worked for me was using an older version of puppeteer-core@1.20.0

Steps

Stop node-red

From /home/pi/.node-red/ run

npm uninstall puppeteer then

npm install puppeteer-core@1.20.0

Start NR

Updated Flow for PI that uses the above core version :

[{"id":"7c406736d4aa3380","type":"inject","z":"6bac277c160c8769","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":400,"y":480,"wires":[["9fb94f39f2c85611"]]},{"id":"9fb94f39f2c85611","type":"function","z":"6bac277c160c8769","name":"puppeteer","func":"node.status({ fill: \"green\", shape: \"dot\", text: \"Processing...\" });\n\ntry {\n\n    node.warn(\"Creating Browser\");\n    const browser = await puppeteer.launch({\n        headless: true,\n        executablePath: '/usr/bin/chromium-browser',\n    })\n\n    node.warn(\"New Page\");\n    const page = await browser.newPage();\n    \n    node.warn(\"Go to\");\n    await page.goto('https://www.bad-schallerbach.at/system/web/kalender.aspx?sprache=1&menuonr=226753868&typids=226758838,226758840,226758842,226758844/', {\n        // waitUntil: 'networkidle2'  // <-- good practice to wait for page to fully load \n    });\n\n    node.warn(\"Click cookie\");\n    await page.click('.bemCookieOverlay__btn--save');\n\n    node.warn(\"waitForTimeout\");\n    await page.waitFor(5000)\n\n    node.warn(\"Evaluate data\");\n    msg.payload = await page.evaluate(() => {\n        // @ts-ignore\n        return Array.from(document.querySelectorAll(\".ris_table tr\")).map(el => el.innerText)\n    })\n\n    // make the data nice ;)\n    msg.payload = msg.payload.map(el => { return { \"DATUM\": el.split(\"\\n\")[0], \"TERMIN\": el.split(\"\\n\")[1] } })\n\n    node.warn(\"Close Browser\");\n    await browser.close();\n\n    node.status({});\n    return msg;\n\n\n} catch (error) {\n    node.status({});\n    node.warn(error);\n};\n\n\n\n\n\n\n\n\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"puppeteer","module":"puppeteer-core"}],"x":630,"y":480,"wires":[["9620fe8243f9691e"]]},{"id":"9620fe8243f9691e","type":"debug","z":"6bac277c160c8769","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":480,"wires":[]}]
1 Like