Selenium WebDriver is a great tool, but itβs not a tool for testing. Itβs a tool for browser manipulation.
And Selenide is a tool for automated testing (build on top of Selenium WebDriver).
There are several testing libraries around Selenium WebDriver. But it seems that they do not resolve the main problems of UI tests. Namely, instability of tests caused by dynamic content, JavaScript, Ajax, timeouts etc. Selenide was created to resolve these problems.
First of all, Selenide makes your tests stable by resolving (almost) all Ajax/timing issues.
Selenide provides a concise API for using Selenium WebDriver in UI tests:
You can find more details below.
You donβt need to operate with WebDriver directly. Selenide will start and shut down the browser automatically whenever itβs needed.
Selenide provides concise API for that makes your tests shorter and more readable. Selenide has convenient methods for operating controls like textfield, radiobutton, selectbox, searching elements by texts 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").selectOptionByText("What is my first car?");
}
When testing Ajax applications we often need to wait until some element changes its state. Selenide has built-in methods for waiting.
Any of the following methods waits until the described event happens. Default timeout is 4 seconds.
$("#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);
When your test fail, Selenide will automatically take screenshot. You do not need to do anything for it.
Look at this presentation to find out more Selenide benefits: