Asset 1
This website uses cookies.
We use cookies so that we can offer you the best user experience possible. By using our website you consent to the usage of cookies and agree with our Privacy Policy.

Selenium is the most powerful free tool for automating functional testing of web applications. It is based on an imitation of the actions of an ordinary user when working in a browser. The developer is required to think over and write a script for user actions and checks, and Selenium will reproduce it in a browser. This also means that Selenium can be used not only for testing but also for performing any frequently repeated routine work for the web. To be more precise, Selenium is not even a tool, but a whole set of tools, each of which provides its own functionality for automation.

Selenium

Main components of Selenium

The choice of a specific tool or several of them depends on the needs of the developer and the characteristics of the project that needs to be tested.

Selenium IDE

It is a plug-in for Mozilla Firefox that records and reproduces user actions in a browser. Selenium IDE does not require a deep programming knowledge from the tester, in most cases, it independently generates code and can rightfully be considered the easiest tool to use. Using the IDE, you can quickly become familiar with the command language and understand how Selenium works. Selenium IDE is mainly used to quickly create small scripts or to perform any routine. However, it is not possible to implement complex logic or validation in IDE scripts. You can also use Selenium IDE when writing tests in other tools to quickly get the identifiers of the elements on the page. An important feature of the Selenium IDE is that you can export the finished script in the format of any programming language supported by Selenium for JUnit or Nunit.

Selenium WebDriver

It is a set of libraries of API functions for various programming languages ​ which allows you to write a program to control the browser in the selected programming language. WebDriver API is not tied to test frameworks, this allows you to use any unit testing frameworks of your choice. The library provides drivers for working in various browsers (Mozilla Firefox, Google Chrome, Opera, Internet Explorer, as well as Android and iPhone mobile browsers), as well as HtmlUnitDriver, which is the fastest cross-platform solution that allows you to run tests without rendering and launching the browser. Using Selenium WebDriver, you can create your own full-fledged testing framework.

Selenium RC

Selenium RC has the same properties as WebDriver. It is also a set of libraries for browsers, but taking into account the narrow focus, namely, the possibility of remote control. Therefore, the arsenal of RC capabilities is much lower. Nevertheless, this version has lost its relevance and therefore is practically not in demand among users. At the moment, WebDriver is considered the main solution package.

Selenium Server

Previously, Selenium Server was required to run Selenium RC, now if you intend to use only WebDriver, then Selenium Server will not be useful to you. But Selenium Server may be needed to run tests on remote machines with different operating systems and installed browsers.

Selenium Grid

This solution is presented as a cluster of servers under the control of the Selenium project. With this tool, you can manage a group of servers and configure the network at your discretion. Thus, you have the opportunity to launch the number of browsers that is necessary to complete the task.

What is Selenium good for?

There are a lot of Selenium benefits among which there are the two main ones:

  • By creating test scenarios of Selenium that reproduce user actions, you test the application from the perspective of the end-user.
  • Running tests in different browsers will make it easier to determine the Internet browser incompatibility.

The core element of Selenium, also known as the browser bot, is written in JavaScript. This allows test scripts to be implemented in supported browsers. The browser framework executes commands received from test scripts that are written either in HTML, using a table layout, or in a supported programming language.

Creating a project to develop tests using Selenium WebDriver

The steps required to create a software project that allows you to develop tests using Selenium depend on which programming language you are going to do.

Selenium WebDriver

Selenium Java combination

The easiest way for this programming language is to use Maven to create a project. Maven will automatically download the Selenium 2.0 Java client library along with all the dependencies and create a project using the pom.xml file (project configuration file). After you have done this, you can import the project into your preferred development environment (IDE) - IntelliJ IDEA or Eclipse. Another way to write tests using Selenium Webdriver and Java as a programming language is to download the Selenium Webdriver JAR files from the Selenium website.

Selenium PHP combination

To start automatic Selenium testing you need php-webdriver, a modern, powerful library for managing the browser by issuing Selenium commands.

php composer.phar require facebook/webdriver php composer.phar require phpunit/phpunit php composer.phar require rmccue/requests

Selenium C # combination

Starting with version 2.2.0, Selenium is supplied as a set of signed DLLs and all libraries on which Selenium depends. Prior to version 2.2.0, all Selenium DLLs were unsigned. To include Selenium in your project, simply download the latest version of the selenium-dotnet zip archive from https://code.google.com/p/selenium/downloads/list. Extract the contents of the archive and add links to the unzipped DLLs to your project.

Selenium Ruby combination

Ruby has borrowed all the best from other programming languages, from smalltalk to Java, from Perl to Python. In order to be able to run Selenium testing in Ruby, you need to execute the following commands:

gem install selenium-webdriver
gem install rest-client
gem install test-unit

Selenium Python combination

If you use Python to automate testing, then most likely you are already familiar with how the development of applications on it occurs. At the moment, probably more than tens of thousands of different libraries have been invented for it. The main advantage of this language is the simplicity of its syntax, as there is no “;" at the end of the line; no need to indicate the type of variable every time. To add Selenium to your Python environment, run the following command in a command line:

pip install selenium

Selenium Node JS combination

Make sure that you have all the necessary libraries installed before starting Selenium testing with Node JS.

npm install -g selenium-webdriver

As well as you need to have Selenium’s language bindings for Javascript: http://www.seleniumhq.org/download/


List of online tools for web testing

Comparium

Comparium screen

Comparium is a user-friendly online tool for web testing. With its help, you can test your site in order to find any potential visual incompatibility in any Internet browser and even with specifying the platform. Just enter the URL of the site you want to test, wait for a few minutes and you will get screenshots of this site taken in each of the selected browsers. Comparium supports most popular browsers as well as operating systems. So, if you want to test the site in order to be sure that everything looks correct and without any bugs, then Comparium is a great choice.

CrossBrowserTesting

CrossBrowserTesting screen

The service checks the site through more than 1,500 desktop, mobile browsers, and more than 40 operating systems. CrossBrowserTesting is designed to detect inaccuracies in the operation of your site on the basis of any operating systems and browsers, including devices based on Android and iOS. The list of the offered functions is huge. Individual attention should be paid to live testing mode feature, in which you can perform web testing in a real environment, getting the opportunity to test the performance of AJAX, HTML forms, JavaScript, Flash, etc.

LambdaTest

LambdaTest screen

With LambdaTest, you can easily test your public or locally hosted website in 1400+ different browsers, web browser versions, operating systems, and resolutions. Thanks to this solution, you can be sure that your customers will get the perfect pixel experience, no matter what device they are using. The app has a lot of useful features, including interactive testing and debugging in live remote browsers, execution of resolution Display Testing and automatic creation of screenshots on several devices, performing smart user interface testing, etc.

Browsershots

Browsershots screen

Browsershots is an easy-to-use online tool for checking site cross-browser compatibility. It allows you to test the site in the main stationary browsers, while you can specify different versions of programs. This service is good if you want to test the visual appearance. However, you cannot actually test the navigation elements and forms. In other words, with this free tool for website testing, you can make sure that the tested site looks normal in various versions of stationary browsers. Browsershots offers a great list of web browsers, as well as the ability to select the screen size, color saturation, enable and disable JavaScript (you can specify a specific version of JavaScript) Java and Flash.

SauceLabs

SauceLabs screen

In this multifunctional service, you can also check the cross-browser site online. The number of supported browsers, screen sizes, and devices is huge - about 700 combinations. SauceLabs estimates the compatibility of not only PC browser, but also mobile devices. The service is paid, but there is a free period of 14 days. This online web testing tool also offers the possibility of unlimited manual testing.

BrowserStack

BrowserStack screen

BrowserStack is another big name in cross-browser testing. It also uses a great number of emulated smartphones and tablets, real devices for web testing as well as software installed on the computer. This service supports the largest number of browsers: a total of 61 different versions of browsers and operating systems. There is the possibility of local testing and quick capture of screenshots at different screen resolutions from 800:600 to 2048:1536. The application is equipped with various useful functions, including disabling and enabling javascript, Java, Flash and changing the screen extension.

Browsera

Browsera screen

Browsera is a really multifunctional tool that allows you to test not only the cross-browser layout, but also the performance of scripts in different situations, the display of dynamic pages, the degree of site security etc. This solution automatically notifies you of possible problems that are detected when running web testing. Instead of checking each screenshot, you will receive a report that will explain in detail which pages of your site have problems.

Frequently Asked Questions: Selenium tutorial