How do you actually keep puppeteer scripts from breaking when websites redesign their layouts?

I’ve been working with Puppeteer for about two years now, and the biggest pain point I keep running into is brittleness. You build a script that works perfectly for weeks, then the client redesigns their site and suddenly everything breaks. You’re back to square one trying to figure out which selectors changed.

I started thinking about this differently after I realized the real problem isn’t Puppeteer itself—it’s that I’m hardcoding every interaction. Selectors, navigation paths, everything is rigid. When the UI changes, the whole thing collapses.

Recently I learned about using plain language descriptions to generate workflows instead of hand-coding selectors. The idea is that you describe what you want to do (like “log in and extract the user data”) and the system generates resilient logic that adapts better to layout changes because it understands intent rather than just memorizing DOM paths.

There’s also something about AI Copilot systems that can produce workflows from descriptions, which seems to handle UI variations better than my brittle scripts. I’m curious if anyone else has tackled this problem and what approach actually worked for you. Do you re-test and re-fix every time a site updates, or have you found a way to make your automations more flexible?

This is exactly the kind of problem I see teams struggle with constantly. The issue is that when you hardcode selectors, you’re building fragility into the foundation.

What changed for me was switching to a workflow that uses AI Copilot to generate the automation from a plain English description. Instead of writing out every selector and click, I describe the task—“log in with credentials, navigate to the dashboard, extract revenue numbers”—and the system builds a resilient workflow that understands the intent behind each step.

The real advantage is that these workflows adapt better to UI changes because they’re built on semantic understanding, not rigid DOM queries. When a website redesigns, the workflow often continues working because it’s solving the problem, not just following hardcoded paths.

I’ve also found that version control for workflows helps. You can test changes in a dev environment, roll back if something breaks, and deploy with confidence.

If you want to see how this works in practice, check out https://latenode.com. The AI Copilot Workflow Generation feature is specifically designed to handle this brittleness problem.

This topic was automatically closed 6 hours after the last reply. New replies are no longer allowed.