Selenide. Selenium WebDriver
While working on the automation system of the printing company Ardecs Print Activity, we faced the necessity of tests automation. Along with using Selenium WebDriver, we have resolved that we should learn capability of framework for automated testing of web-applications based on Selenium WebDriver - Selenide.
Selenium WebDriver is one of the most popular tools for writing acceptance tests and integration tests. Writing UI tests is a challenging task: there is a number of problems, each and everybody meet with. Primarily they are Ajax-requests, dynamic web pages and timeouts. Selenide can solve these issues: it helps quickly and easily use Selenium WebDriver while writing tests to concentrate on logic, not the mess with browser.
The key features of Selenide:
- Concise syntax, a la jQuery
- Solving of most problems with Ajax, waiting and timeouts
- Browser sessions management
- Automatic screenshot taking
Selenide provides additional methods for actions, which cannot be performed with the only command of Selenium WebDriver, such as radio button selection, an item from drop-down list selection, screenshot taking, browser cache clearing.
Having AJAX-requests can be challenging while creating automated UI-tests. While Selenium offers powerful API for wait a variety of events, Selenide simply offers not to bother. If it is necessary to confirm that the button is green, but it is not, Selenide simply waits until it is green. Of course, timeout is configured (4 seconds on default).
public void pageUsingAjax() {
$("#username").shouldBe(visible); // wait until the item appears
$("#username").shouldHave(text("Hello, Johny!")); // wait until the item text will switch to "Hello, Johny!"
$("#login-button").shouldHave(cssClass("green-button")); // wait until the button is green
$("#login-button").shouldBe(disabled); // wait until the button is disabled
$(".error").shouldNotBe(visible); // wait until the item disappears
$(".error").should(disappear); // try to do the same with Selenium in one string!
}
Using JUnit or TestNG, Selenide is capable to take screenshots automatically adding one string. It is suitable not only for error tests, but for any tests at all.
public ScreenShooter makeScreenshotOnFailure = ScreenShooter.failedTests();
@Rule
public ScreenShooter makeScreenshotOnEveryTest = ScreenShooter.failedTests().succeededTests();
Library Selenide derived its name from chemical element (selenium). In turn, selenides are the conpounds of selenium with other elements. Selenide = Selenium + JUnit; Selenide = Selenium + TestNG; Selenide = Selenium + ScalaTest; Selenide = Selenium + whatsoever.
Selenide operates in many companies in actual projects, the product is supported and it is developing.
The use of Selenide while working with Ardecs Print Activity significantly simplified and sped up the testing in developing process. This experience allows to test effectively in many of our projects.