Docs

Why isn't Selenium WebDriver enough?

Selenium WebDriver is a great tool for driving browsers. Selenide is a tool for testing, built on top of it.

Motivation

Selenium WebDriver is a great tool, but it’s not a testing tool. It’s a tool for driving browsers.

Selenide is a tool for automated testing, built on top of Selenium WebDriver.

Why yet another Selenium wrapper?

There are several testing libraries around Selenium WebDriver, but most of them don’t solve the main problem of UI tests: instability caused by dynamic content, JavaScript, asynchronous loading, timeouts and so on. Selenide was created to solve exactly that.

What does Selenide give you over plain Selenium?

First of all, Selenide makes your tests stable by solving (almost) all timing issues.

It gives you a concise API for using Selenium WebDriver in UI tests:

  • Smart waiting
  • Transparent WebDriver
  • Convenience methods
  • Automatic screenshots

The details are below. For a side-by-side comparison of the same test, see Why Selenide.

Smart waiting

Dynamic pages change all the time, and tests often need to wait until an element reaches the right state. Selenide waits for you: each of the following lines waits until the described state is reached, 4 seconds by default.

$("#topic").should(appear);
$("#topic").shouldBe(visible);

$("#topic").should(disappear);
$("h1").shouldHave(text("Hello"));
$(".message").shouldNotHave(text("Wait for loading..."));
$(".password").shouldNotHave(cssClass("errorField"));

$(".error").should(disappear);

Transparent WebDriver

You don’t need to work with WebDriver directly. Selenide starts and shuts down the browser automatically whenever needed.

Convenience methods

Selenide’s concise API makes your tests shorter and more readable. It has convenient methods for text fields, radio buttons, select boxes, finding elements by text and so on.

@Test
public void canFillComplexForm() {
  open("/client/registration");
  $(By.name("user.name")).val("johny");
  $(By.name("user.gender")).selectRadio("male");
  $("#user.preferredLayout").selectOption("plain");
  $("#user.securityQuestion").selectOption("What is my first car?");
}

Automatic screenshots

When a test fails, Selenide takes a screenshot automatically. You don’t need to do anything for it.

More benefits

This is just a short summary. There’s much more:

Watch this presentation to learn more about Selenide’s benefits:

Didn't find the answer?

Ask the community, we answer fast: Selenide examples · Telegram · Report an issue