A computer-use agent reads a screenshot or accessibility tree, chooses a mouse or keyboard action and repeats until the goal is met. That lets it operate apps and websites that have no API. Examples are Anthropic Computer Use, OpenAI's Operator (built on its computer-using agent model), Google Project Mariner and the open-source Browser-Use.

Computer-Use / Browser AgentsDiagram with these labels, in reading order: Capture Screen; Plan Action; (click/type/Dom); Execute in; Sandboxed Browser; Re-Screenshot; Goal Met?; (Decision).Capture ScreenPlan Action(click/type/Dom)Execute inSandboxed BrowserRe-ScreenshotGoal Met?(Decision)
Loop of Browser Agent Actions

The observe, act, verify loop

The agent runs one loop per step. A multimodal model looks at the current GUI state, decides on the next action and returns either coordinates or a reference to a DOM element. An executor then performs the action in a controlled browser, usually inside a sandbox, often driven through a library such as Playwright.

  1. Capture the screen, or read the accessibility tree of the application.
  2. Ask the model to plan the next click or keystroke from that state.
  3. Execute the action in the sandboxed browser.
  4. Take a new screenshot to check the result.
  5. Repeat until the goal is reached or a human is asked to confirm.

Take a form on a legacy web application. The agent captures the page, identifies the fields from their labels and positions in the accessibility tree, plans the inputs and fills them in. If the layout shifts, it re-reads the page and finds the fields again.

DOM grounding versus pixel coordinates

An action can be anchored to a pixel position or to an element in the DOM or accessibility tree. Pixel clicks break when the layout moves a little and land on the wrong element. Grounding on the DOM structure is faster and more stable, because the agent looks the element up again each step instead of trusting a stored position.

Selenium and Playwright scripts are the closest relative. Those scripts fix their selectors in advance and break when the page changes. A computer-use agent chooses actions from the current page and the goal, so it tolerates small UI changes. The price is speed: each step waits on a model call, and a scripted test runs faster and more predictably.

Injected page text and the sandbox around the agent

The agent reads whatever the page shows, so text injected into a page can mislead it into actions nobody intended. Scripted test automation has much less of this exposure, because it does not read the page to decide what to do. Four controls limit the damage:

  • Run the browser in a confined container that can reach allowlisted domains only.
  • Give the agent least-privilege credentials.
  • Require human confirmation for irreversible actions.
  • Add content-injection defenses on what the agent reads.

Prompt injection is a serious risk for this class of agent, and these controls reduce it without removing it.

Choosing between an API, an MCP tool and a browser agent

Scraping a system without an API tends to be unreliable and can break the provider's terms of service. Manual operation is slow and error-prone. A browser agent covers the gap for older internal applications and third-party portals.

OptionUse whenTrade-off
API or MCP toolOne existsFaster, cheaper and safer than driving a GUI
Browser agentThe system has no APILatency from the feedback loop, plus injection risk
Scraping or manual workRarelyFragile, may breach terms of service, slow
Latency Screen capture and action planning add delay at every step, so the loop does not suit real-time use.

Example scenario: click failures after a UI change

Example scenario: an agent starts missing 30% of its button clicks after the target web application ships a UI update. The DOM structure or CSS has changed, and the agent now misidentifies elements it used to find.

Computer-Use / Browser AgentsDiagram with these labels, in reading order: XPath Issue; Loading Issue; Fix XPath; Fix Load Strategy; GUI Element Recognition; Failure; Incorrect Element XPath; Dynamic Element Loading; Issues; Update XPath Selectors; Implement Wait Strategies.XPath IssueLoading IssueFix XPathFix Load StrategyGUI Element RecognitionFailureIncorrect Element XPathDynamic Element LoadingIssuesUpdate XPath SelectorsImplement Wait Strategies
Debugging Browser Agent Failure
  • Read the browser console for JavaScript errors during the failing interactions.
  • Log each attempted interaction and compare it with the expected element identifiers such as IDs and classes.
  • Run a visual regression tool to compare the current UI with the one the agent was built against.

The fix is to update how the agent identifies elements so it matches the new structure. Watch the task completion rate closely for the following week.

Back to the knowledge baseRequest an assessment