<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao" -->

---
title: Webwright: Why AI Web Agents Should Write Code, Not Click
description: Webwright, a browser-agent framework from Microsoft Research and the University of Hong Kong, gives AI models a terminal instead of a fixed menu of click...
canonical: https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Webwright: Why AI Web Agents Should Write Code, Not Click | daily.dev
og:description: Webwright, a browser-agent framework from Microsoft Research and the University of Hong Kong, gives AI models a terminal instead of a fixed menu of click...
og:url: https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao
og:image: https://api.daily.dev/og/posts/31MTr7xAO.png
og:image:alt: Webwright: Why AI Web Agents Should Write Code, Not Click
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Webwright: Why AI Web Agents Should Write Code, Not Click

**[Towards Data Science](https://daily.dev/sources/tds)** · 20 min read · 0 upvotes · 0 comments

## Summary

Webwright, a browser-agent framework from Microsoft Research and the University of Hong Kong, gives AI models a terminal instead of a fixed menu of click actions, letting them write and run Playwright/bash scripts to accomplish web tasks. Rather than leaving behind a disposable click trace, the agent produces reusable code. On the Odysseys benchmark, GPT-5.4 jumps from 33.5% (coordinate-based control) to 60.1% success with Webwright, and it scores 86.7% on Online-Mind2Web, beating Claude Opus 4.7's 84.7%. The core harness is roughly 1,000 lines split into three components: Runner, Model Endpoint, and Environment. Hands-on tests scraping books.toscrape.com, quotes.toscrape.com/js, and an infinite-scroll page show the agent building working CLI tools, catching its own bugs, and verifying data completeness, though at higher token/compute cost than simple click-based agents.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://towardsdatascience.com/webwright-why-ai-web-agents-should-write-code-not-click>

## Questions this post answers

### How much does Webwright improve GPT-5.4's performance on the Odysseys benchmark compared to coordinate-based browser control?

GPT-5.4 using coordinate-based browser control scores 33.5% on the Odysseys benchmark, while the same model using Webwright's terminal-based code-writing approach reaches 60.1%, a 26.6-point gain attributed entirely to changing the harness rather than the model itself.

_Developers evaluating agent harnesses can track benchmark shifts like this one on daily.dev._

### What are the three core components of the Webwright browser-agent framework and how many lines of code are they?

Webwright's core harness is about 1,000 lines split into three parts: a Runner (~150 lines) tracking task state and history, a Model Endpoint (~550 lines) connecting to OpenAI, Anthropic, or OpenRouter backends, and an Environment (~300 lines) giving the model a terminal wired to Playwright running Chromium, where commands actually execute.

_Anyone architecting a lean agent harness can follow implementation breakdowns like this on daily.dev._

### How much does it cost to run a task with Webwright using GPT-5.4 versus Claude Opus 4.7?

Running a task through Webwright costs about $2.37 with GPT-5.4 and $6.09 with Claude Opus 4.7, reflecting extra upfront compute spent building reusable tools rather than just completing a one-off click sequence. These are LLM-judged AutoEval scores, and the headline Mind2Web result uses only 100 of 300 tasks.

_Teams comparing model costs for agentic workflows can weigh tradeoffs like these on daily.dev._

## Similar posts on daily.dev

- [Building programmable QA with AI](https://daily.dev/posts/building-programmable-qa-with-ai-funlrqjoa) · thoughbot · 3 upvotes · 0 comments
- [When will browser agents do real work?](https://daily.dev/posts/when-will-browser-agents-do-real-work--frnrhcksh) · InfoWorld · 0 upvotes · 0 comments
- [I'm Building Agents That Run While I Sleep](https://daily.dev/posts/i-m-building-agents-that-run-while-i-sleep-psrvg5tk0) · Hacker News · 2 upvotes · 0 comments
- [AI Browser Agents 2026: Stagehand vs Browser Use](https://daily.dev/posts/ai-browser-agents-2026-stagehand-vs-browser-use-of9lhq6hu) · Alex CloudStar · 0 upvotes · 0 comments
- [Building Browser-Using AI Agents in Python](https://daily.dev/posts/building-browser-using-ai-agents-in-python-wzikpcbci) · Machine Learning Mastery · 1 upvotes · 0 comments

---

Tags: [#llm](https://daily.dev/tags/llm), [#ai-agents](https://daily.dev/tags/ai-agents), [#automation](https://daily.dev/tags/automation), [#crawling](https://daily.dev/tags/crawling)

[View this post on daily.dev](https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Webwright: Why AI Web Agents Should Write Code, Not Click","url":"https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao"},"datePublished":"2026-08-17T16:54:08.842Z","dateModified":"2026-09-14T06:30:32.861Z","description":"Webwright, a browser-agent framework from Microsoft Research and the University of Hong Kong, gives AI models a terminal instead of a fixed menu of click...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b82e75c85e138218cd00cf79a6eba894?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b82e75c85e138218cd00cf79a6eba894?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Towards Data Science","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Towards Data Science","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/tds","url":"https://daily.dev/sources/tds"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"llm,ai-agents,automation,crawling","timeRequired":"PT20M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Towards Data Science","item":"https://daily.dev/sources/tds"},{"@type":"ListItem","position":3,"name":"Webwright: Why AI Web Agents Should Write Code, Not Click"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/webwright-why-ai-web-agents-should-write-code-not-click-31mtr7xao#faq","mainEntity":[{"@type":"Question","name":"How much does Webwright improve GPT-5.4's performance on the Odysseys benchmark compared to coordinate-based browser control?","acceptedAnswer":{"@type":"Answer","text":"GPT-5.4 using coordinate-based browser control scores 33.5% on the Odysseys benchmark, while the same model using Webwright's terminal-based code-writing approach reaches 60.1%, a 26.6-point gain attributed entirely to changing the harness rather than the model itself. Developers evaluating agent harnesses can track benchmark shifts like this one on daily.dev."}},{"@type":"Question","name":"What are the three core components of the Webwright browser-agent framework and how many lines of code are they?","acceptedAnswer":{"@type":"Answer","text":"Webwright's core harness is about 1,000 lines split into three parts: a Runner (~150 lines) tracking task state and history, a Model Endpoint (~550 lines) connecting to OpenAI, Anthropic, or OpenRouter backends, and an Environment (~300 lines) giving the model a terminal wired to Playwright running Chromium, where commands actually execute. Anyone architecting a lean agent harness can follow implementation breakdowns like this on daily.dev."}},{"@type":"Question","name":"How much does it cost to run a task with Webwright using GPT-5.4 versus Claude Opus 4.7?","acceptedAnswer":{"@type":"Answer","text":"Running a task through Webwright costs about $2.37 with GPT-5.4 and $6.09 with Claude Opus 4.7, reflecting extra upfront compute spent building reusable tools rather than just completing a one-off click sequence. These are LLM-judged AutoEval scores, and the headline Mind2Web result uses only 100 of 300 tasks. Teams comparing model costs for agentic workflows can weigh tradeoffs like these on daily.dev."}}]}
```

