Browser automation, explained: drivers, protocols and local APIs

What browser automation is for, how WebDriver-style drivers, DevTools-protocol libraries and extension scripts differ, and where a local HTTP API fits in.

Updated 16 November 2026 6 min read

Browser automation means having a program do what you would otherwise do by hand: open a page, click, type, wait, read what appears. It is how teams test web apps before a release, and how individuals stop doing the same twenty clicks every Monday. There are several ways to drive a browser from code, and they suit different jobs. This article walks through them in plain terms and then looks at one more: an API built into the browser you already use.

What people automate a browser for

  • Testing. A script signs in to your web app, adds an item to the cart and checks that the total is right. Run it on every change and you catch breakage before your users do.
  • Repetitive tasks. Downloading the same monthly report, filling in the same form, or checking a dashboard and noting one number.
  • Screenshots and PDFs. Capturing how a page looks, on a schedule or across many pages.
  • Watching for a change. Loading a page now and then and telling you when something on it is different.

What these have in common is a real page. Many sites build their content with JavaScript after loading, so fetching the raw HTML is not enough. You need something that behaves like a browser, and the simplest such thing is a browser.

The usual ways to drive a browser

WebDriver-style drivers

WebDriver is a web standard for remote control of browsers. Your script sends commands such as "find this button" and "click it" to a small driver program, and the driver passes them to the browser. Because it is a standard, the same test can run against several browsers, and there are libraries for most programming languages.

This approach is the backbone of cross-browser test suites. It usually starts a fresh browser with a clean profile for each run, which is what a test wants. The moving parts are the cost: a driver for each browser, kept in step with the browser's version.

DevTools-protocol libraries

Browsers have a debugging interface, the one their built-in developer tools use. A second family of libraries talks to the browser through that interface. This gives fine control: you can watch network requests, change responses and record detailed traces.

These libraries are fast and pleasant to script, and they commonly download their own copy of a browser to drive. That makes results repeatable. It also means the browser being automated is usually not the one you use every day.

Extension and user scripts

A script can also run inside the page itself, installed through a browser extension. This is the lightest option and is good for small adjustments to sites you visit. It is limited to what a page is allowed to do. It cannot open windows freely, manage tabs across sites or run while the browser is closed.

A fourth option: a local API in the browser itself

The fourth approach puts the control surface inside the browser. The browser listens on an address on your own computer and accepts ordinary web requests: open this address in a tab, click this element, give me the text of that page. Anything that can send an HTTP request can drive it, from a shell script to a spreadsheet macro.

The difference is what is on the other end. It is your browser, with your profiles, your sign-ins and your settings. A script can work in a session where you are already signed in, without storing your password in the script. There is no separate driver to install or keep in step.

It has trade-offs too. It is specific to one browser, so it is not a way to test your site in every browser. And because it can act as you, the API must stay private: listening on your own machine only, behind a key.

How the approaches compare

ApproachStrongest atKeep in mind
WebDriver-style driverTesting one site in several browsersA driver per browser to install and update
DevTools-protocol libraryFast, detailed scripting and tracingUsually drives its own copy of a browser
Extension or user scriptSmall changes to pages you visitLimited to what a page may do
Local API in the browserAutomating the browser and sessions you already useTied to that browser, and must be kept private

These are not rivals so much as tools for different jobs. A team may run a cross-browser suite before releases and still use a local API for the weekly chores.

Automating responsibly

A script can make a thousand requests in the time you make one, so a few habits matter.

  • Read the terms. Automating your own site and your own accounts is ordinary. Collecting content from someone else's site may not be allowed.
  • Respect robots.txt. It is where a site says which parts automated visitors should leave alone.
  • Go slowly. Add pauses. A person does not load fifty pages a second.
  • Keep the door closed. Leave a control API on your own machine, and treat its key like a password.

How Vela does it

Vela for Mac includes an Automation API. You turn it on in Settings → Automation with Enable Automation API. By default it listens on 127.0.0.1, port 1306, which means only programs on your own Mac can reach it. Every request must carry your API key, in an X-API-Key header.

Opening a page in a new tab is one request:

curl -X POST http://127.0.0.1:1306/api/tabs \
  -H "X-API-Key: $VELA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

From there the API covers the things a script needs: navigate, click, fill in and type into fields, wait for an element, extract text, take a screenshot or a PDF, and read or set cookies. A WebSocket connection at /api/events reports what happens in the browser as it happens. Tabs can be opened in a chosen profile, so a script can work inside the right set of sign-ins.

There are three ways to run it. In the normal, headed mode you watch the browser work. Hidden mode runs the full browser with its windows invisible, and sessions persist. Headless mode is lighter, and its sessions do not persist. Hidden and headless instances use port 1307 by default, so they can run next to the browser you are using.

To try it, start with the Automation API quick start, then read about headless and hidden mode. Every endpoint is listed in the API docs.

Questions, answered.

What is the difference between headless and headed automation?

A headed browser shows its windows while a script drives it, which is useful when you want to watch. A headless browser runs with no visible window, which suits servers and scheduled jobs.

Do I need to know how to program to automate a browser?

A little. Most tools expect a short script, but a local HTTP API can be driven with one-line commands such as curl, which is an easy place to start.

Is it legal to automate a website?

Automating your own site or your own account for testing and routine tasks is normal practice. Collecting data from other sites depends on their terms and on the law where you live, so read the terms and the site's robots.txt before you start.

Is Vela's Automation API available on iPhone and iPad?

No. The Automation API and its hidden and headless modes are part of Vela for Mac.

Keep reading.

All articles
Developers

Automate Vela with its local API: a quick start

Switch on the local API, then open a tab, read the page and save a screenshot from Terminal.

6 minMac
Developers

Run Vela in hidden or headless mode for scripts

Start Vela from Terminal with no window on screen, then drive it through the local API.

6 minMac
How the web works

Profiles, private windows or a second browser: which one?

Four ways to stay signed in to two accounts on one site, what each one really separates, and when to use which.

6 minBlog