First automation (CLI)
A short, runnable walkthrough driving Chrome from the command line with bl.
This is the human on-ramp: a handful of real bl commands that navigate a page,
capture it, find elements, and interact with them. If you haven't installed
browserlane yet, start with Install.
Visible by default
Every command below opens a real Chrome in a visible, maximized window so you can watch what happens and debug the automation as it runs.
Open a page
bl open https://example.combl open <url> navigates to the URL (a bare host like example.com gets
https:// prepended) and prints basic page info. Run bare bl open with no
URL and it just launches a local browser on about:blank. Either way the
browser stays open between commands, so the next command acts on this same page.
Capture a screenshot
bl screenshot -o page.pngWithout -o, the file is named screenshot.png in the current directory.
Add --full-page to capture the whole page instead of just the viewport.
Map the interactive elements
bl mapbl map lists the page's interactive elements and assigns each a short ref
like @e1, @e2. You then act on those refs directly — no CSS selectors
required.
Click something
bl click @e1bl click accepts either a ref from bl map or a CSS selector
(bl click "a"). It auto-waits for the element to be actionable before
clicking. After anything that changes the page, run bl map again — refs
from the old page no longer apply.
Read the page text
bl textbl text prints the page's text content. Pass a selector to scope it, e.g.
bl text "h1".
Find an element semantically
bl find text "More information"bl find locates elements without a CSS selector. Beyond text, it
supports role, label, placeholder, testid, alt, title, and
xpath. Each match comes back as a ref you can act on:
bl find role button # → @e1 [button] "Submit"
bl click @e1Assert page state
bl expect title contains "Example"bl expect turns a check into a pass/fail verdict: it prints
PASS expect title contains "Example" and exits 0 when the assertion
holds, or reports the actual value and exits 1. You can assert the URL,
title, text, element state (visible / hidden / enabled / checked),
a form value, an element count, or any JavaScript expression — the building
block for scripted flows and CI checks.
Run JavaScript
bl eval "document.title"bl eval is the escape hatch for anything the CLI doesn't cover directly —
any DOM query or mutation. The expression's result is printed; use
--stdin to pipe in longer scripts and avoid shell-quoting headaches.
Chaining commands
Because each command acts on the same open page, you can chain a sequence with
&& — it stops on the first error:
bl open https://example.com && bl map && bl click @e1 && bl mapRun commands separately when you need to read one command's output before
deciding what to do next (for example, reading bl map to pick which ref to
click).
Where to go next
- Learn the map → act → re-map loop in Selectors, refs, and the map/act/re-map loop.
- Understand auto-waiting vs. explicit waits.
- Browse every command in the CLI reference.