I also experimented with .evaluate() and .click() methods but none of these solutions worked for me. Has anyone successfully cleared browsing data programmatically using Puppeteer? I need a working solution for this automation task.
yea, chrome settings can be tricky! try using the chrome devtools protocol (CDP) to clear browsing data instead, it’s way more reliable than messing with the settings page. also launching with --disable-web-security might help. gl!
Honestly though, this stuff gets messy quick. I moved to Latenode for browser automation because it wraps all the CDP headaches into simple drag-and-drop nodes.
No more writing brittle code that breaks every Chrome update. Just connect the browser actions you want and it handles the protocol stuff automatically.
Saved me countless hours debugging weird browser quirks.
Had the same issue last month with a web scraping project. Keyboard shortcuts never worked reliably - Chrome just ignores them when launched through Puppeteer.
Here’s what actually fixed it - launch Chrome with flags to start fresh every time:
This creates a temp user data directory that gets wiped between runs. Way simpler than clearing history mid-session. If you really need to clear during runtime, use the CDP BrowsingData method mentioned above, but honestly the clean launch approach works better.
I’ve used this approach for over two years in production. The BrowsingData.clearBrowsingData method is built for history removal - way better than generic storage clearing methods. Just make sure your Chrome version supports this CDP domain. It’s been stable since Chrome 72.
you could also launch with --incognito flag - no history gets saved so there’s nothing to clear. way easier than cdp commands imo, just throw it in your launch args and you’re set