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, visible Chrome window so you can watch what
happens. Add --headless to any command to hide the window — handy on a
server or in CI.
Open a page
bl go https://example.combl go navigates to the URL and prints basic page info. 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 @e1Run 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 go 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.