Browser automation has been stuck in a rut for years. The dominant tools — Selenium, Puppeteer, Playwright — are powerful, but they're built for testing, not for real-world task automation. You want to scrape a competitor's pricing page? Write a 40-line script. Need to search Google and Bing simultaneously and compare results? That's another script. Want to chain a login flow with a data extraction step? Now you're managing async state, waiting for selectors, and praying nothing times out.
I've been writing browser automation code for years, and I kept running into the same friction: too much boilerplate for tasks that should take one command. That frustration led me to xbrowser, a CLI tool designed specifically for developers and AI agents who need to get things done in a browser without writing a full test suite every time.
Let's be clear — Playwright and Selenium are excellent at what they do. If you're writing end-to-end tests for a web application, they're the right choice. But when your use case shifts from "test my app" to "interact with the web," the cracks start to show:
What I wanted was something like curl
but for interactive browser tasks — a single command that handles the complexity and gives me the result.
xbrowser is an open-source (MIT) browser automation CLI that ships as a single npm package:
npm i -g @dyyz1993/xbrowser
That's the entire installation. No separate browser download, no WebDriver setup, no configuration files. It comes with a managed Chromium build that includes CDP fingerprint protection — meaning the sites you visit can't easily detect that you're running an automated browser.
The tool is designed around composable commands that map to real-world tasks rather than low-level browser APIs. Let me walk through the core features.
Searching the web from the command line shouldn't require an API key. xbrowser handles the browser interaction for you:
xbrowser search "headless browser automation tools" --engine google --num 10
xbrowser search "headless browser automation tools" --engine bing --num 10
xbrowser search "无头浏览器自动化工具" --engine baidu --num 10
Each command returns structured results with titles, URLs, and snippets. You can pipe them into jq
for filtering, save them to a file, or feed them directly into an AI agent's context.
This is particularly useful for competitive analysis. Want to see how your brand ranks across search engines?
xbrowser search "my product name" --engine google --num 30 | jq '.results[] | select(.url | contains("myproduct.com"))'
No API keys, no rate limits to manage, no OAuth flows. Just search and get results.
The scrape
command extracts clean, structured content from any URL:
xbrowser scrape https://example.com/blog/my-article
xbrowser crawl https://example.com --depth 3 --max-pages 100
xbrowser map https://example.com
The scrape
output is markdown by default, which means it's immediately usable — paste it into a document, feed it to an LLM, or parse it with standard text tools.
crawl
follows internal links and respects depth limits, giving you a complete content snapshot of a site. map
produces a flat list of every reachable URL, which is invaluable for SEO audits.
Here's a practical example — auditing your own site's internal link structure:
xbrowser map https://mysite.com > sitemap.txt
cat sitemap.txt | while read url; do
count=$(xbrowser scrape "$url" | grep -c "href=")
echo "$url: $count links"
done
This is the feature that sets xbrowser apart. Instead of writing multi-step scripts, you chain operations in a single command:
xbrowser chain "goto https://news.ycombinator.com && click '.titleline > a' && scrape"
xbrowser chain "goto https://app.example.com/login \
&& fill '#email' 'user@example.com' \
&& fill '#password' 'my-password' \
&& click '#login-button' \
&& wait '#dashboard' \
&& scrape '#dashboard'"
The chain syntax reads like natural language: go to this page, click this element, fill in that field, scrape the result. It mirrors how you'd describe the task to another person.
For AI agent workflows, this is a game-changer. An agent can construct chain commands dynamically based on user intent:
User: "Go to Hacker News, click the top story, and summarize it for me"
Agent constructs:
xbrowser chain "goto https://news.ycombinator.com && click '.titleline > a:first-of-type' && scrape"
No script generation, no debugging async code, no selector management. The agent just builds a chain string and executes it.
xbrowser ships with 67+ plugins, and the SEO suite is particularly comprehensive:
xbrowser seo backlinks --domain example.com
xbrowser seo audit https://example.com/page
xbrowser search "target keyword" --engine google --num 30 --analyze
The backlink plugin crawls referring domains, checks link status, and reports on link quality metrics. The audit plugin checks meta tags, heading structure, image alt text, and other on-page factors.
For link-building workflows, you can combine search and scraping:
xbrowser search "write for us + web development" --engine google --num 20 | \
jq -r '.results[].url' | \
while read url; do
xbrowser scrape "$url" | grep -i "guidelines\|submit\|contribute"
done
Sometimes you need to automate a complex workflow that's hard to express as a chain. That's where recording comes in:
xbrowser record my-workflow
xbrowser replay my-workflow --headless
Record your workflow once in a visible browser, then replay it on a schedule or in CI. This is perfect for:
Let me be straightforward about when to use what:
| Feature | xbrowser | Playwright | Selenium |
|---|---|---|---|
| Installation | |||
npm i -g (one step) |
|||
| npm install + browser download | npm install + WebDriver | ||
| CLI-first | |||
| Yes | No (library-first) | No (library-first) | |
| Search helpers | |||
| Google/Bing/Baidu built-in | None | None | |
| SEO plugins | |||
| 67+ built-in | None | None | |
| Chain syntax | |||
goto && click && scrape |
|||
| Requires script | Requires script | ||
| Record/Replay | |||
| Built-in | Codegen (code output) | IDE plugins | |
| Anti-detection | |||
| CDP fingerprint protection | Basic stealth plugins | External tools | |
| Test framework | |||
| Not designed for this | Primary use case | Primary use case |
The key distinction: xbrowser is for doing things on the web. Playwright and Selenium are for testing things on the web. Different goals, different tools.
If you're building an AI agent that needs to browse the web, scrape data, perform SEO analysis, or automate repetitive browser tasks, xbrowser gives you composable commands that map directly to those tasks. If you're writing integration tests for your React app, stick with Playwright.
npm i -g @dyyz1993/xbrowser
xbrowser --help
xbrowser search "hello world" --engine google
Three commands and you're up and running. The full documentation, plugin directory, and API reference are available at xbrowser.dev. The source code is on GitHub under the MIT license.
If you're building AI agents that interact with the web, or if you're tired of writing 50-line scripts for tasks that should take one command, give it a try. Contributions and plugin submissions are welcome.
xbrowser is open source under the MIT license. Install with npm i -g @dyyz1993/xbrowser. Docs and examples at xbrowser.dev.