Selenium or Selenide?

Davit Danelia
TBC Engineering
Published in
5 min readApr 7, 2021

--

Why TBC Bank is using both of them?

I want to introduce you to Test Automation in TBC Bank, specifically about how we are supporting TBC products with test automation, what frameworks are we using and why?

As we all know, big products needs big support for a perfect performance, it’s getting harder to catch regression bugs in any level of production while your project is growing by the day, new functionality, components, logic, rules, features, we need all that without any bugs, for that every team has not only manual testers but also Test automation engineers for any kind of automation testing, today i gonna talk about UI automation testing frameworks that most of TA engineers are using nowadays and specifically about Selenium and Selenide and why sometimes we prefer Selenide over Selenium.

First of all lets talk about Selenium, writing a successful UI Selenium tests can be challenging at times. AJAX requests, timeouts, code duplication, and dynamic content pages are only a couple of the challenges that Automation Engineers face. Selenium Webdriver is one of the most commonly used UI testing tools not only in TBC but in every other companies too. however it is important to realize that Selenium is a low-level framework library for handling browsers. Trust me, I have been using Selenium for a long time and I can assure you that it is not fully optimized for handy test writing.

Selenide is a framework based on a web driver from Selenium. Selenide has been developed for automatic testing as a simpler and easier option. It has many special characteristics, for example:

  • Smart waiting (more intelligent waits)
  • Selenide wrapped WebDriver
  • Comfortable methods
  • Ajax support
  • Automated screenshots
  • Customization

Let’s find out how Selenide streamlines the tasks of the testers and what benefits Selenide has over Selenium.

Smart waiting & Ajax support

Online apps are now dynamic. Any framework component can be rendered/changed dynamically at any time. This causes a slew of issues for automatic experiments. A green test today could turn red at any time because the browser ran some javascript for a little longer than normal, sometimes it’s a real pain…

Selenide is quite quick to solve most of these problems.

Just said, if necessary, each Selenide approach is waiting a little. We call it “smart waitings.”

When we write :

Selenide checks whether the variable occurs and includes “Hello” text.

If it hasn’t already, Selenide expects that the feature will be dynamically modified soon and waits the normal 4 seconds, which is normally enough time for most web applications to load. And, of course, it can be personalized😉.

Nope, Selenide is just waiting for not loaded element, If the element is available on the page already — Selenide will not wait. If element appears after 500 ms, Selenide will only wait for 500 ms. That’s perfect for Test time management!

What about Ajax support?

When testing Ajax applications we often need to wait until some element changes its current state. Selenide has built-in methods for element state waiting .

Any of the following methods waits until the described event happens (appear, visible, disappear). Default timeout as i already said is 4 seconds.

Transparent WebDriver

I think that is the best “feature” of Selenide

Imagine you don’t have to interact with WebDriver directly… Yes, Selenide is performing this type of magic, and it will also automatically start and shut down the browser as desired.

Simple And Clear, without creating Driver and repeating it over and over…

Like this…

Convenience methods

Selenide has a beautiful API for shortening and making your tests more readable. Selenide offers convenient operating control methods for radiobuttons, selectboxes, text fields, and searching elements by text, id, class, etc.

beautiful right? lets continue exploring this beautiful thing

Automated screenshots

You may know my previous post about : Selenium(Java) Hack you MUST know as an Test Automation Engineer! P.2

where i was showing how to (Catch failed Test Cases with screenshot in Selenium)

BOOOOM! In Selenide when your test fail, it will automatically take screenshot. You do not need to do anything for it… That’s cheating 🙄

Customization

lets say you need to check a condition that isn’t available out-of-the-box, you can quickly build it yourself. Let’s consider the case of writing a CSS condition or even asserts:

As you see you can check css condition by using css() Selenide function WITHOUT using ASSERT ! yes! Selenide already contains Assert inside shouldHave function

and it’s more usable than css check using Selenium:

That’s only part of features that Selenide contains itself which makes our life easier, now you know why in TBC Bank we using Selenide sometimes more often than Selenium!

Peace ✌️!

--

--

Davit Danelia
TBC Engineering

SDET at EPAM systems / QA Lead at Sharemac / GeoSTQB Inovations boar member