Docs
Poor software doesn't have documentation. Brilliant software doesn't need it.
Selenide is simple enough that you won't need tons of docs. The whole API is three things: open a page, find an element, act or check. Here is the reference for everything else.
Three simple things
- Open the page:
open(url) - Find an element and act on it:
$(selector).click() - Check a condition:
$(selector).shouldHave(text("..."))
open("/login");
$("#submit").click();
$(".message").shouldHave(text("Hello"));
That’s it. Everything below is detail.
Use the power of your IDE
The Selenide API is just a few classes. We suggest you stop reading, open your IDE and start typing.
Type $(selector). and your IDE will suggest everything you can do with the element:

Your IDE beats any documentation, and so does your AI assistant: Selenide’s API is small and stable, so models write it well.
Selenide API reference
The complete reference is in the Selenide javadoc. For a guided tour of how Selenide works inside, see Selenide on DeepWiki. These are the classes you’ll use most of the time.
com.codeborne.selenide.Selenide
The core of the library. The main methods are open, $ and $$. Import them statically for readability: import static com.codeborne.selenide.Selenide.*.
open(String url)opens the browser (if it isn’t open yet) and loads the URL.$(String cssSelector)returns aSelenideElement: the first element on the page matching the CSS selector.$(By)does the same for anyBylocator.$$(String cssSelector)returns anElementsCollection: all elements matching the CSS selector.$$(By)does the same for anyBylocator.
In Kotlin, where $ is awkward, use the aliases element() and elements().
When you get a SelenideElement with $, you can perform an action on it:
$(byText("Sign in")).click();
or several actions at once:
$(byName("password")).setValue("qwerty").pressEnter();
or check a condition:
$(".welcome-message").shouldHave(text("Welcome, user!"));
The double dollar $$ is handy when the element you need is one of many similar ones. Instead of
$(byXpath("//*[@id='search-results']//a[contains(text(),'selenide.org')]")).click();
write the more readable
$$("#search-results a").findBy(text("selenide.org")).click();
Most operations on elements found by $ and $$ wait automatically, as long as the context needs. So in most cases you don’t need to think about waiting at all, even on highly dynamic pages.
Don’t be shy to look for more methods in the Selenide class: type Selenide. in your IDE and browse the suggestions. A few examples:
sleep(),
refresh(),
title(),
executeJavaScript(String jsCode, Object… arguments).
com.codeborne.selenide.SelenideElement
SelenideElement represents an element on the page. You usually get one from $. It’s lazy: Selenide looks the element up only when you use it, and looks it up again if the page has changed.
Finding inner elements
find(String cssSelector)/$(String cssSelector)find(By)/$(By)findAll(String cssSelector)/$$(String cssSelector)findAll(By)/$$(By)
$ and $$ are short aliases for find and findAll. Use them to build a locator chain step by step:
$("#header").find("#menu").findAll(".item");
Checks (assertions)
should(Condition)/shouldBe(Condition)/shouldHave(Condition)shouldNot(Condition)/shouldNotBe(Condition)/shouldNotHave(Condition)
Pick the alias that makes the line read like an English sentence:
$("input").should(exist);
$("input").shouldBe(visible);
$("input").shouldHave(exactText("Some text"));
Checks are Selenide’s explicit waits. They wait until the condition (visible, enabled, text("some text")) is met or the timeout runs out. The timeout is Configuration.timeout, 4000 ms by default.
You can use a check before an action to wait for the right state: $("#submit").shouldBe(enabled).click();
You can also set the timeout for a single check:
$("input").shouldBe(visible, Duration.ofSeconds(30));
Actions
click(),doubleClick(),contextClick(),hover()setValue(String)/val(String),append(String),clear()pressEnter(),pressEscape(),pressTab(),press(Keys...)selectOption(String),selectOptionByValue(String),selectRadio(String value),setSelected(boolean)dragAndDrop(to("#target")),scrollTo(),scrollIntoView(...)- …
Most actions return the same SelenideElement, so you can chain them: $("#edit").setValue("text").pressEnter();
Getting state and attributes
getValue()/val()attr(String),data(String)text(): the visible text on the pageinnerText(): the text of the element in the DOMgetSelectedOption(),getSelectedOptionText(),getSelectedOptionValue()isDisplayed(): false if the element is hidden or doesn’t exist in the DOM, otherwise trueexists(): true if the element exists in the DOM, otherwise false
Other useful methods
uploadFromClasspath(String fileName),uploadFile(File...)download(): downloads a file and returns itscreenshot(): takes a screenshot of just this elementtoWebElement(): gives you the raw SeleniumWebElement
com.codeborne.selenide.Condition
Conditions are used in should / shouldNot checks. Import them statically to keep the code readable:
| Condition | Example |
|---|---|
visible / appear | $("input").shouldBe(visible) |
exist | the element exists in the DOM, possibly hidden |
hidden / disappear | $(".spinner").should(disappear) |
enabled / disabled | $("#submit").shouldBe(enabled) |
interactable, clickable, editable | $("#name").shouldBe(editable) |
checked, selected, focused, readonly, empty | $("h2").shouldBe(empty) |
text(String) | substring: $("h1").shouldHave(text("Hello")) |
exactText(String) | the whole text |
textCaseSensitive(String), exactTextCaseSensitive(String) | |
matchText(String regex) | $("#id").shouldHave(matchText("\\d+")) |
value(String), name(String), id(String), type(String) | $("input").shouldHave(value("John")) |
attribute(name), attribute(name, value) | $("#input").shouldHave(attribute("required")) |
cssClass(String) | $("#list li").shouldHave(cssClass("checked")) |
com.codeborne.selenide.Selectors
By selectors that standard Selenium WebDriver doesn’t have: find elements by text, attributes, labels or inside shadow DOM.
byTextfinds an element by its exact text,withTextby a substring.byLabelfinds an input by the text of its label.byPlaceholder,byTitle,byValue,byAltTextfind elements by those attributes.byTestIdfinds an element by itsdata-test-idattribute.by(attributeName, attributeValue)finds an element by any attribute.shadowCss(selector, shadowHost)finds an element inside shadow DOM.byXpath,byId,byName,byClassName… for everything else.
$(byText("Login")).shouldBe(visible);
$(byLabel("Email")).setValue("john@example.com");
$(By.xpath("//div[text()='Login']")).shouldBe(visible); // any org.openqa.selenium.By works
$(byXpath("//div[text()='Login']")).shouldBe(visible); // or its alternative from Selectors
com.codeborne.selenide.ElementsCollection
A collection of all elements matching a locator. You usually get one from $$.
Checks
shouldBe, e.g.$$(".errors").shouldBe(empty)shouldHave, e.g.$$("#mytable tbody tr").shouldHave(size(2))
Collection checks wait too, until the condition (size(2), empty, texts("a", "b", "c")) is met or Configuration.timeout runs out.
Getting state
size(),isEmpty()texts(): the visible texts of all elements, e.g.["a", "", "c"]for<li>a</li><li hidden>b</li><li>c</li>
Picking elements
filterBy(Condition)returns only the elements that match the condition, e.g.$$("#multirowTable tr").filterBy(text("Norris"))excludeWith(Condition)does the opposite, e.g.$$("#multirowTable tr").excludeWith(text("Chuck"))get(int)returns the n-th element as aSelenideElementfirst(),last()findBy(Condition)returns the first element that matches the condition
com.codeborne.selenide.CollectionCondition
Conditions for ElementsCollection checks. Import them statically, too.
empty, e.g.$$("#list li").shouldBe(empty)size(int), e.g.$$("#list li").shouldHave(size(10))sizeGreaterThan(int),sizeGreaterThanOrEqual(int),sizeLessThan(int),sizeLessThanOrEqual(int),sizeNotEqual(int)texts(String...): substrings,exactTexts(String...): whole texts,textsInAnyOrder(String...)itemWithText(String),allMatch(...),anyMatch(...),noneMatch(...),attributes(...)
com.codeborne.selenide.WebDriverRunner
Browser management methods:
isChrome(),isFirefox(),isHeadless()url()returns the current URLsource()returns the HTML source of the current pagegetWebDriver()returns theWebDriverinstance (created by Selenide or set by you), so you always have the raw Selenium API at handsetWebDriver(WebDriver)tells Selenide to use a driver you created yourself. From then on, closing it is your job (e.g.getWebDriver().quit()).
com.codeborne.selenide.Configuration
Settings for your Selenide tests, for example:
timeout: how long checks and actions wait, in milliseconds. 4000 by default; change it with e.g.Configuration.timeout = 6000;browser:"chrome","firefox","edge","safari"headlessbaseUrlremote: the URL of a Selenium Grid or a cloud providerreportsFolder- …
Every setting can also be passed as a system property, which is handy on CI: -Dselenide.baseUrl=https://staging-server.com/start.
Or put them in src/test/resources/selenide.properties. See the FAQ for details.
Didn't find the answer?
Ask the community, we answer fast: GitHub Discussions · Telegram · Report an issue