Prompt

How do I keep automations working when a website layout changes?

Technology / Low-Code / No-Code1 observationLast seen Nov 6, 2026

Latest observation

Nov 6, 2026OpenAI APIWeb search: off

To keep automations working when a website layout changes, build them to be resilient to UI changes rather than tied to exact page structure.

Practical strategies

1) Prefer stable selectors

Use attributes that are less likely to change:

  • id
  • name
  • data-* attributes
  • aria-label
  • unique text labels

Avoid fragile selectors like:

  • long absolute XPath
  • positional CSS selectors like div > div:nth-child(3) > ...
  • classes generated by frameworks that change often

2) Target behavior, not layout

Instead of selecting by where something appears on the page, select by:

  • button text
  • form labels
  • link destinations
  • element roles

Example:

  • Better: button[aria-label="Save"]
  • Worse: div.header > div.actions > button:nth-child(2)

3) Add fallback selectors

If one locator fails, try a backup:

  • primary selector
  • alternate text-based selector
  • nearby label-based selector

This helps when small markup changes happen.

4) Use page semantics

For browser automation, use:

  • accessible roles
  • labels
  • form associations

Examples:

  • getByRole("button", { name: "Submit" })
  • getByLabel("Email")

These are usually more robust than raw DOM paths.

5) Wait for the right state

Many failures happen because the page is still loading or elements are dynamic. Use:

  • explicit waits for visibility/clickability
  • network idle or page-ready checks
  • retries for transient conditions

Avoid fixed sleep delays unless necessary.

6) Handle optional and moving content

If sections may appear/disappear:

  • check existence before interacting
  • don’t assume a fixed order
  • search within a container instead of the whole page

7) Keep automation logic modular

Separate:

  • navigation
  • element-finding
  • form filling
  • validation

That way, if the layout changes, you only update the locator logic, not the entire automation.

8) Monitor and detect breakage early

Add:

  • screenshots on failure
  • DOM or HTML snapshots
  • logging of failed selectors
  • alerts when automation success rate drops

This makes layout changes visible quickly.

9) Use APIs when possible

If your automation is doing a task that the site supports through an API, prefer the API over UI automation. APIs are much more stable than page layouts.

10) Build maintenance into the process

Expect occasional updates:

  • keep selectors in one config/file
  • version your automations
  • periodically test against staging or a test account

Good rule of thumb

If a selector depends on visual position, it’s probably fragile.
If it depends on meaning or stable attributes, it’s much safer.

If you want, I can also show:

  • a Playwright example
  • a Selenium example
  • or a selector checklist for making automations more durable.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.