DEV Community

Noah Taro
Noah Taro

Posted on

Build Automation Around Observable State, Not UI Clicks

UI automation becomes fragile when a click is treated as the outcome. The browser may dispatch the event while the application rejects the request, delays the update, or replaces the original element.

A more reliable workflow has four stages:

  • identify a safe target using stable structure,
  • perform one visible action,
  • wait for the application to settle,
  • verify a durable state change.

For a reaction, that durable state might be a selected control or an increased count. For publishing, it should be the new public item with the expected content. The verification result, not the click call, should drive the final status.

This design also produces better diagnostics. Instead of a generic failure, the system can say whether it never found a target, could not perform the action, or performed it but could not confirm the outcome.

Top comments (0)