1. Introduction: The Paradigm Shift in GUI Agents
Between 2025 and 2026, one of the hottest directions in AI Agents is the GUI Agent — letting AI operate graphical interfaces just like humans. From OpenAI's Computer Use to Anthropic's Claude Computer Use, mainstream approaches follow the "screenshot → multimodal model understanding → simulate mouse and keyboard" pipeline.
There's a fundamental problem with this approach: it's too heavy.
Every operation requires taking a screenshot, sending it to a multimodal model, waiting for inference, then simulating the action. High latency, heavy resource consumption, and frequent failures due to screenshot resolution or UI changes.
Alibaba's Page-Agent, open-sourced in September 2025, proposes a radically different approach: since AI needs to operate web pages, why not let AI live inside the web page itself?
Page-Agent is a pure frontend JavaScript GUI Agent framework. It doesn't need browser extensions, Python backends, Playwright/Selenium, or screenshots — just a single <script> tag to give any web page AI Agent capabilities. As of October 2026, the project has surpassed 29,000 stars on GitHub, making it one of the most popular GUI Agent projects.
2. Core Technology: How DOM Dehydration Changes Web Automation
2.1 What is "DOM Dehydration"?
Page-Agent's core innovation is its DOM Dehydration technology. Simply put, it "dehydrates" the DOM structure of a web page into a pure text representation, stripping away all visual noise and keeping only the semantic information AI needs to understand.
Traditional GUI Agent workflow:
Screenshot → Multimodal model identifies UI elements → Coordinate positioning → Simulate click
Page-Agent workflow:
DOM Dehydration → Textualized UI structure → LLM understands semantics → Direct DOM manipulation
This means Page-Agent doesn't need to "see" the web page — it directly "reads" the page structure. Like a blind programmer who operates a computer by reading code rather than looking at the screen.
2.2 The DOM Dehydration Process
DOM Dehydration involves several key steps:
- Element Filtering: Remove invisible elements, decorative elements, pure styling elements
- Text Extraction: Keep meaningful text content (button labels, tags, input placeholders)
- Structure Simplification: Compress deeply nested DOM trees into flattened semantic representations
- Interaction Annotation: Mark interactive elements (buttons, links, inputs, dropdowns)
The dehydrated DOM representation looks something like this:
[button] "Login"
[text input] "Search..." placeholder="Enter keyword"
[link] "Home" href="/"
[select] Sort by: [option] Newest [option] Hottest [option] Rating
[checkbox] "Remember me"
This text representation is only 1/10 to 1/50 the size of the raw DOM, allowing LLMs to quickly understand and generate operation instructions.
2.3 Fundamental Differences from Traditional Approaches
| Dimension | Selenium/Playwright | Computer Use (Screenshot) | Page-Agent (DOM Dehydration) |
|---|---|---|---|
| Runtime Location | External process controls browser | External process + screenshots | In-page JavaScript |
| Understanding Method | Hardcoded selectors | Multimodal visual understanding | Textualized DOM semantics |
| Latency | Low (direct operation) | High (screenshot + inference) | Medium (DOM parsing + inference) |
| Cross-domain | Limited by same-origin policy | No restrictions | Limited by same-origin policy |
| Deployment Complexity | Needs WebDriver | Needs backend service | One script tag |
| Dynamic Content | Needs wait strategies | Needs re-screenshot | Real-time DOM observation |
Page-Agent's advantages lie in zero deployment cost and real-time response. It doesn't need extra backend services or screenshot transmission — everything happens in the user's browser.
3. Hands-on Testing: Multi-Scenario Operation Showcase
3.1 E-commerce: Automated Search and Filtering
On e-commerce sites, Page-Agent can handle complex search and filtering operations:
import { PageAgent } from 'page-agent'
const agent = new PageAgent({
model: 'qwen3.5-plus',
baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
apiKey: 'your-api-key',
language: 'en-US',
})
// One sentence: search, filter price range, sort by sales
await agent.execute('Search for "mechanical keyboard", filter price $50-$150, sort by best sellers')
Page-Agent automatically: 1. Finds the search box and types "mechanical keyboard" 2. Clicks the search button 3. Finds the price filter controls and sets the $50-$150 range 4. Finds the sort dropdown and selects "Best Sellers"
The entire process requires no manual CSS selectors or XPath.
3.2 Form Filling: ERP/CRM System Automation
Enterprise systems (ERP, CRM, OA) typically have complex forms. Page-Agent can dramatically simplify operations:
// Fill in customer information form
await agent.execute(`
Fill in the following customer info:
- Company: TechXArtisan
- Contact: Kevin
- Email: kevin@example.com
- Phone: +1-555-0123
- Tier: VIP
- Notes: Inquiry from website
Then click the "Save" button
`)
For dynamically loaded form fields (like cascading selectors), Page-Agent waits for elements to appear before operating, avoiding the common "element not found" errors in traditional automation.
3.3 Admin Panels: Batch Operations
In admin panels, Page-Agent can execute batch operations:
// Batch approve users
await agent.execute(`
On the user management page:
1. Find all users with "Pending" status
2. Select those users
3. Click the "Batch Approve" button
4. Click "Confirm" in the confirmation dialog
`)
3.4 Performance Comparison
Performance comparison for identical tasks:
| Metric | Playwright + GPT-4V | Page-Agent + Qwen3.5 |
|---|---|---|
| Per-operation latency | 3-5 seconds (screenshot + inference) | 1-2 seconds (DOM parsing + inference) |
| Bandwidth consumption | High (transmitting screenshots) | Low (transmitting text) |
| Memory usage | High (browser instances) | Low (in-page JS) |
| Concurrency | Limited by browser instances | Theoretically unlimited |
4. Developer Guide: From Integration to Customization
4.1 One-Line Quick Start
The fastest way to try Page-Agent is via the Demo CDN:
<!DOCTYPE html>
<html>
<head>
<title>Page-Agent Demo</title>
</head>
<body>
<h1>My Web Page</h1>
<button id="btn">Click Me</button>
<!-- One-line integration -->
<script
src="https://cdn.jsdelivr.net/npm/page-agent@1.12.4/dist/iife/page-agent.demo.js"
crossorigin="anonymous"
></script>
</body>
</html>
Open the page and you'll see a floating Agent dialog where you can type natural language commands.
Note: The Demo CDN uses a free testing LLM API, for technical evaluation only — not recommended for production.
4.2 NPM Installation with Custom LLM
For production, install via NPM and configure your own LLM:
npm install page-agent
import { PageAgent } from 'page-agent'
const agent = new PageAgent({
// Supports OpenAI-compatible APIs
model: 'gpt-4o-mini',
baseURL: 'https://api.openai.com/v1',
apiKey: 'your-api-key',
// Language setting (affects prompt language)
language: 'en-US',
// Optional: custom DOM dehydration rules
domRules: {
ignoreSelectors: ['.no-agent', '[data-agent-ignore]'],
customAttributes: ['data-action'],
},
})
// Execute operation
await agent.execute('Click the login button')
// Get page state
const state = await agent.getPageState()
console.log(state)
// Listen for action events
agent.on('action:start', (action) => {
console.log('Starting:', action)
})
agent.on('action:complete', (action) => {
console.log('Completed:', action)
})
4.3 React/Vue Integration
React integration:
import { useEffect, useRef } from 'react'
import { PageAgent } from 'page-agent'
function MyComponent() {
const agentRef = useRef(null)
useEffect(() => {
agentRef.current = new PageAgent({
model: 'gpt-4o-mini',
baseURL: 'https://api.openai.com/v1',
apiKey: import.meta.env.VITE_OPENAI_KEY,
language: 'en-US',
})
return () => {
agentRef.current?.destroy()
}
}, [])
const handleCommand = async (command) => {
await agentRef.current.execute(command)
}
return (
<div>
<button onClick={() => handleCommand('Click the submit button')}>
Auto Submit
</button>
</div>
)
}
Vue 3 integration:
<template>
<div>
<button @click="executeCommand('Click the submit button')">
Auto Submit
</button>
</div>
</template>
<script setup>
import { onMounted, onUnmounted, ref } from 'vue'
import { PageAgent } from 'page-agent'
const agent = ref(null)
onMounted(() => {
agent.value = new PageAgent({
model: 'gpt-4o-mini',
baseURL: 'https://api.openai.com/v1',
apiKey: import.meta.env.VITE_OPENAI_KEY,
language: 'en-US',
})
})
onUnmounted(() => {
agent.value?.destroy()
})
const executeCommand = async (command) => {
await agent.value.execute(command)
}
</script>
4.4 Custom Agent Skills
Page-Agent supports custom Skills to give the Agent domain-specific capabilities:
import { PageAgent, defineSkill } from 'page-agent'
// Define an "e-commerce search" skill
const ecommerceSearch = defineSkill({
name: 'ecommerce-search',
description: 'Search products on e-commerce sites with filtering',
parameters: {
keyword: { type: 'string', description: 'Search keyword' },
minPrice: { type: 'number', description: 'Minimum price' },
maxPrice: { type: 'number', description: 'Maximum price' },
sortBy: { type: 'string', enum: ['sales', 'price', 'date'] },
},
execute: async (agent, params) => {
await agent.execute(`Search for "${params.keyword}"`)
if (params.minPrice || params.maxPrice) {
const priceRange = `$${params.minPrice || 0} - $${params.maxPrice || 'any'}`
await agent.execute(`Set price range to ${priceRange}`)
}
if (params.sortBy) {
const sortMap = {
sales: 'Sort by best sellers',
price: 'Sort by price',
date: 'Sort by newest',
}
await agent.execute(sortMap[params.sortBy])
}
},
})
const agent = new PageAgent({
model: 'gpt-4o-mini',
baseURL: 'https://api.openai.com/v1',
apiKey: 'your-api-key',
skills: [ecommerceSearch],
})
// Use the skill
await agent.useSkill('ecommerce-search', {
keyword: 'mechanical keyboard',
minPrice: 50,
maxPrice: 150,
sortBy: 'sales',
})
5. Application Prospects: Who Needs Page-Agent Most
5.1 SaaS Product AI Assistants
SaaS products can quickly add AI assistant features through Page-Agent:
// Embed AI assistant in your SaaS product
import { PageAgent } from 'page-agent'
const assistant = new PageAgent({
model: 'gpt-4o-mini',
baseURL: 'https://api.openai.com/v1',
apiKey: 'your-key',
language: 'en-US',
})
// Users can operate your product with natural language
// "Help me create a new project named Q4 Marketing Plan"
// "Assign all incomplete tasks to John"
Advantages: - No backend API modifications needed - No complex command parsing logic - Zero learning curve for users (just use natural language)
5.2 Enterprise System Automation
Enterprise systems (ERP, CRM, OA) are typically complex to operate. Page-Agent can:
- Simplify training: New employees don't need to learn complex workflows — just tell the AI what to do
- Batch operations: Complete tasks that would normally require dozens of clicks with a single sentence
- Cross-system collaboration: With the Chrome extension, automatically pass data between systems
5.3 Accessibility Enhancement
Page-Agent can help visually impaired users operate web pages through voice commands:
// Combine with Web Speech API for voice control
const recognition = new webkitSpeechRecognition()
recognition.onresult = async (event) => {
const command = event.results[0][0].transcript
await agent.execute(command)
}
recognition.start()
5.4 Test Automation
While Page-Agent primarily targets client-side enhancement, it can also be used for E2E testing:
// Write test cases in natural language
test('User login flow', async () => {
await agent.execute('Type testuser in the username field')
await agent.execute('Type password123 in the password field')
await agent.execute('Click the login button')
await agent.execute('Wait for the page to navigate to the dashboard')
const state = await agent.getPageState()
expect(state.url).toContain('/dashboard')
})
6. Security and Limitations
6.1 Security Considerations
Cross-domain issues: Page-Agent runs inside the page and is restricted by the same-origin policy — it can only operate on the current domain's pages. It cannot operate third-party content in cross-origin iframes.
Sensitive operation protection: Add operation whitelists in production:
const agent = new PageAgent({
allowedActions: ['click', 'type', 'select'],
blockedSelectors: ['[data-sensitive]', '.payment-form'],
requireConfirmation: ['delete', 'submit', 'payment'],
})
API Key security: Exposing API Keys in the frontend carries risks. Recommended approaches: - Use a proxy server to relay LLM requests - Set API Key rate limits - Use short-lived tokens instead of long-term keys
6.2 Current Technical Limitations
- Dynamically rendered content: For SPAs or dynamically loaded content, must wait for DOM stability before operating
- Canvas/WebGL: Cannot operate content rendered by Canvas or WebGL
- Shadow DOM: Limited Shadow DOM support (improving)
- Complex interactions: Drag-and-drop, gestures, and other complex interactions are still in development
- LLM dependency: Operation accuracy depends on LLM comprehension — complex instructions may fail
6.3 Comparison with Alternatives
| Solution | Type | Advantages | Disadvantages |
|---|---|---|---|
| Page-Agent | Frontend JS | Zero deployment, low latency | Same-origin policy restrictions |
| browser-use | Python backend | Full-featured | Needs backend service |
| Playwright | Browser automation | Stable and reliable | Requires writing selectors |
| Selenium | Browser automation | Mature ecosystem | Complex configuration |
| Computer Use | Multimodal AI | Highly general | High latency, high cost |
7. Conclusion and Reflections
Page-Agent represents an important direction for GUI Agents: letting AI live inside the web page, rather than controlling it from outside.
The advantages are clear: - Zero deployment cost: One script tag to integrate - Low latency: No screenshot transmission, direct DOM manipulation - High concurrency: No browser instances needed, theoretically unlimited concurrency - Real-time response: DOM changes detected immediately, no re-screenshots needed
But there are also clear limitations: - Same-origin policy restrictions: Cannot operate across domains - LLM dependency: Operation accuracy limited by LLM capabilities - Security risks: Frontend API Key exposure requires additional protection
For SaaS products, enterprise systems, accessibility, and similar scenarios, Page-Agent provides a lightweight, low-cost AI Agent solution. It's not trying to replace Selenium or Playwright — it fills the gap of "in-page AI automation."
As LLM capabilities continue to improve and browser APIs evolve, "AI that lives in web pages" like Page-Agent will become increasingly powerful. Future web pages may no longer be "interfaces for humans" but "interfaces shared by humans and AI."
Repository: https://github.com/alibaba/page-agent
Live Demo: https://alibaba.github.io/page-agent/
FAQ
1. What is Page-Agent? How does it differ from ChatGPT Computer Use?
Page-Agent is a pure frontend JavaScript GUI Agent framework open-sourced by Alibaba. It lets AI operate the DOM directly inside web pages. The key difference from Computer Use: Computer Use takes screenshots, uses multimodal models to understand screen content, then simulates mouse/keyboard. Page-Agent reads the DOM structure directly, uses textualized representation for LLM understanding, then manipulates the DOM. The former is like "remote desktop", the latter is like "AI living inside the web page."
2. Does Page-Agent need backend support? Can it run entirely in the browser?
Page-Agent itself is a pure frontend library that runs entirely in the browser. However, it needs to call an LLM API to understand user instructions and generate operation plans, so it needs an accessible LLM service (cloud API or locally deployed model). Beyond LLM calls, no other backend services are needed.
3. How do I integrate Page-Agent into my website? Do I need to change existing code?
The simplest integration is adding a <script> tag to your HTML. To use your own LLM, install via NPM and initialize a PageAgent instance. Usually no existing code changes are needed — Page-Agent automatically analyzes the current page's DOM structure. But for custom behavior (ignoring elements, adding skills), you'll need to write some configuration code.
4. Which browsers does Page-Agent support? Does it work with IE?
Page-Agent supports all modern browsers (latest Chrome, Firefox, Safari, Edge). Due to modern JavaScript features (ES Modules, async/await), IE is not supported. You can use Babel for transpilation, but official compatibility is not guaranteed.
5. How secure is Page-Agent? Could it be maliciously exploited?
Page-Agent is restricted by the same-origin policy and can only operate on the current domain — it cannot perform cross-origin attacks. However, be aware: exposing API Keys in the frontend carries risk, so use a proxy server for requests. For sensitive operations (delete, payment), add confirmation mechanisms. Page-Agent doesn't automatically execute any operations — all instructions require explicit user input or code invocation.