# Puppeteer/ chromium help

**URL:** <https://discourse.nodered.org/t/puppeteer-chromium-help/94979>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [29 January 2025 09:32 UTC](https://discourse.nodered.org/t/puppeteer-chromium-help/94979 "2025-01-29T09:32:45Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [30 January 2025 07:15 UTC](https://discourse.nodered.org/t/puppeteer-chromium-help/94979/11 "2025-01-30T07:15:19Z")

</div>

Any puppeteer node for node-red has issues (at least that is what I found), especially when there are updates to chromium or the puppeteer package. Instead I have switched to the npm package and use a function node to go through the actions.

In the setup tab use (make sure to install chromium via the commandline):

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c5947534c32d929ddeddf1a4ed4e6207b765b67d.png)

and for the code itself, example:

```auto
function delay(time) {
    return new Promise(function (resolve) {
        setTimeout(resolve, time)
    });
}

const browser = await puppeteer.launch({
    headless: true,
    executablePath: '/usr/bin/chromium',
    args: [
        '--incognito',
    ]
});
const user = 'someuser'
const pass = 'somepasswprd'

node.status({ fill: "yellow", shape: "ring", text: "starting browser" });
const page = await browser.newPage();

await page.goto('https://example.com/', {
    waitUntil: 'networkidle2', networkIdleTimeout: 15000
})
node.status({ fill: "blue", shape: "ring", text: "login" });

await page.waitForSelector('#user');
await page.locator('#user').fill(user);
await page.locator('#password').fill(pass);
await page.locator('.btn-primary').click();

await page.waitForNavigation({ waitUntil: "networkidle2" });
await delay(2000);
...

```

---

_[View the full topic](https://discourse.nodered.org/t/puppeteer-chromium-help/94979)._
