Docs

Selenide CLI

Drive a real browser from the shell, one command at a time, and get runnable Selenide Java code. Made for AI coding agents, handy for humans.

Selenide CLI drives a real browser with simple shell commands and records everything you do as Selenide Java code. Any AI agent that can run shell commands can use it, and it costs fewer tokens than an MCP server.

selenide open <url> starts (or reuses) a background daemon holding a live browser. Each next command (selenide click "#submit", selenide setValue "#email" x, selenide code) is a short-lived process that talks to the daemon, runs one command, prints the result and exits. Every successful command is recorded, so selenide code prints a runnable Selenide test at any moment.

Installation

npm install -g @selenide/cli
selenide --version

Requirements: JDK 17+ on your PATH and a browser (Chrome, Firefox or Edge). Selenium Manager downloads the matching driver on first run.

Troubleshooting:

  • Java 17+ is required / ENOENT: install JDK 17+, or point JAVA_HOME to one.
  • command not found: selenide: add npm’s global bin folder to your PATH: export PATH="$(npm prefix -g)/bin:$PATH".

Using with AI agents

Agents can use the CLI without any setup: selenide --help documents every command. To give your agent richer context up front, install the bundled skill (full command grammar, selectors and code generation conventions):

selenide install --skills           # -> .claude/skills/selenide-cli/  (Claude Code)
selenide install --skills=agents    # -> .agents/skills/selenide-cli/  (Codex and other agents)
selenide install --skills --global  # into your home folder instead of the current project

If an installed skill gets out of date after you upgrade the CLI, it prints a warning telling you to rerun install.

For agents that read AGENTS.md, add a section like this:

## Browser automation & Selenide codegen

Use `selenide-cli` (`npm install -g @selenide/cli`; requires JDK 17+ on PATH) to drive a real
browser and record a Selenide Java test as you go:

    selenide open <url>
    selenide click "<selector>"
    selenide setValue "<selector>" "<text>"
    selenide should "<selector>" visible
    selenide code      # print the generated Selenide Java
    selenide close

Selectors: CSS by default; `text=<text>` for byText; `xpath=<expr>` (or a leading `//`) for byXpath.
Run `selenide --help` or `selenide <command> --help` for the full reference.

Then just ask your agent: “Write a Selenide test for the login page of my app.”

Quick start

selenide open --headless https://the-internet.herokuapp.com/login
selenide setValue "#username" tomsmith
selenide setValue "#password" "SuperSecretPassword!"
selenide click "button[type=submit]"
selenide should "#flash" text "You logged into a secure area!"
selenide code                            # print the generated Selenide Java
selenide save src/test/java/LoginTest.java
selenide close                           # stop the browser and the daemon

selenide code prints:

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.open;

open("https://the-internet.herokuapp.com/login");
$("#username").setValue("tomsmith");
$("#password").setValue("SuperSecretPassword!");
$("button[type=submit]").click();
$("#flash").shouldHave(text("You logged into a secure area!"));

Commands

Lifecycle

CommandWhat it does
open [options] <url>Start or reuse the session’s daemon and browser, and go to <url>
closeClose the browser and stop the daemon
listList sessions (running / stale)
close-allClose every session
install --skills[=agents] [--global]Install the bundled agent skill

Recorded actions

Each of these is added to the generated code:

click <sel>                    setValue <sel> <text>   (alias: type)
append <sel> <text>            clear <sel>
selectOption <sel> <text>      selectRadio <sel> <value>
check <sel> | uncheck <sel>    setSelected <sel> <bool>
hover <sel>                    doubleClick <sel>        contextClick <sel>
scrollTo <sel>                 pressEnter|pressTab|pressEscape <sel>
should <sel> <cond> [value]    back | forward | refresh
frame <sel>                    defaultContent
screenshot [name]

Code generation

These aren’t recorded:

CommandWhat it does
codePrint the generated Selenide Java
save <file>Save it to a file
undoRemove the last recorded step
resetStart the recording over

Selectors and conditions

Selectors are CSS by default. Quote any selector containing spaces so the shell passes it as one argument. text=<text> becomes byText, and xpath=<expr> (or anything starting with //) becomes byXpath:

selenide click "#submit"
selenide click "button[type=submit]"
selenide click "text=Sign In"
selenide click "xpath=//button[@id='go']"

Conditions for should: visible, hidden, exist, disappear, enabled, disabled, selected, checked, editable, readonly, empty, focused, text, exactText, value, exactValue, cssClass, matchText, attribute <name> [value].

Sessions

Run several isolated browsers at once with -s <name> (the default session is default):

selenide -s auth   open https://app.example.com/login
selenide -s public open https://example.com
selenide -s auth   click "#login"
selenide list
selenide close-all

Daemon state lives in ~/.selenide-cli/ (<session>.port, <session>.log).

Options for open

--browser=<name>, --headless, --browser-size=<WxH>, --base-url=<url>, --timeout=<ms>, --remote=<url>, --reports-folder=<dir>, --capability=<name>=<value> and more. They apply when the daemon is first started. Also --version / -v and --help / -h.

See the full command reference and the configuration reference.

Didn't find the answer?

Ask the community, we answer fast: GitHub Discussions · Telegram · Report an issue