← All posts

Automation · May 5, 2026

I Built a Browser Bot That Never Breaks — Here's How

G

Web Dev George

Builder · Educator · Automation Architect

The Breaking Problem

Every browser automation I built before this one had the same life cycle: I'd spend a few hours getting it working perfectly, feel good about it, and then three weeks later it would break because the site it was scraping had updated its layout. I'd fix it. It would break again. At some point I stopped building them because the maintenance cost was eating the value.

Stop Telling It Where to Click

The problem with traditional browser automation is that scripts rely on hard-coded selectors — a specific class name, a specific ID, a specific position in the DOM. The moment any of that changes, the bot is blind. It can't adapt. It just fails.

The fix is to stop telling the bot where to click and start telling it what to do. Instead of 'click the element with class btn-primary-checkout', you give an AI layer the goal: 'complete the checkout process'. The AI looks at what's actually on the screen and figures out how to achieve the goal regardless of what the underlying HTML looks like.

The Stack

I use Playwright for the actual browser control, and Claude's vision capability to read the page and decide what action to take next. The bot takes a screenshot at each step, sends it to Claude with the current goal, and Claude returns the next action — click this, type that, scroll down, wait for this element. It's slower than a hard-coded selector script. But it works on pages I've never seen before, and it keeps working after redesigns.

The self-healing part comes from the error handling. When the bot hits something unexpected — a modal, a CAPTCHA, a changed layout — instead of crashing, it takes a screenshot of the problem and asks Claude what to do next. Most of the time Claude figures it out. The bot adapts in real time without me touching the code.

When This Makes Sense

This isn't the right architecture for everything. If you're scraping millions of pages at speed, a vision-based approach is too slow and too expensive. But for automations that need to run reliably over long periods on sites you don't control — account monitoring, form submissions, data collection from complex UIs — it's the most durable thing I've built. Three months, no manual fixes. That's a record for me.