A Deep Dive into Selenium, Its Alternative Solution for 2020 and Beyond
Selenium was first released in the mid-2000s as a Web browser extension for recording and playing back interactions with Web browsers. Since then, it has become arguably the most popular tool for test automation. In a survey of the automation testing community, the framework has been used by more than 80% of those surveyed.
Selenium is an open-source framework for Web-based application automation that includes Selenium WebDriver, Selenium IDE, and Selenium Grid.
- Selenium WebDriver is the core automation component that drives user interactions in browsers, serving as the foundation for the other components.
- Selenium IDE is a browser extension that records and plays back user interactions in the browser.
- Selenium Grid enables WebDriver to run automation tests on many machines, browsers, and operating systems at the same time.
Selenium is widely adopted in the software automation community thanks to the advantages it offers. First, it is developer-friendly and supports developers to write and test in any preferred programming language. Also, the framework is cross-browser and cross-operating systems, allowing teams to perform test automation on many browsers and operating systems, which is an essential requirement for the success of automation testing.
The Architecture of Selenium WebDriver
The Selenium WebDriver architecture consists of three components: WebDriver, Browser Specific Drivers or Drivers, and Browser. The communications between these components are bidirectional or two-way, sending HTTP requests and receiving HTTP responses in forms of RESTful services.
- Browser Specific Drivers or Drivers are responsible for controlling the actual browser by relaying requests from WebDriver. Each driver is specific to each browser and usually runs on the same system as the browser. Drivers can be implemented and extended by third parties. GeckoDriver for Firefox and ChromeDriver for Chrome are two driver implementations for these browsers.
- Browser is the actual browser that receives the requests from the Drivers component to drive interactions on the application under test (AUT). Selenium supports all the major browsers, including Chrome, Firefox, Internet Explorer, Opera, and Safari.
WebDriver can run on a different system from the Drivers and Browser components. In this setting, WebDriver communicates remotely with these components via Selenium Server or Remote WebDriver. This allows Selenium to run automation tests on multiple browsers and machines simultaneously.
Advantages of this architecture
Selenium architecture inhibits several key characteristics. It is simple and robust. It has only a few components, each having distinct responsibilities carrying out just enough tasks of writing and executing automation tests on the AUT in the browser. There are no bells and whistles.
The architecture is loosely coupled. Three components communicate via the HTTP protocol with RESTful Web services as the form of communication. This characteristic allows one component to be independent of one another. Enhancements and changes to one component can be made easily and without affecting the others. This loosely coupled architecture allows Selenium to be platform- and language-neutral.
And finally, the architecture is open. Selenium WebDriver is a W3C Recommendation that makes it possible to attract many contributions from the software community.
These characteristics of the architecture lead to many important features of Selenium:
- Cross-platform and cross-language. Users can execute automation scripts on multiple operating systems and browsers as many implementations of the Drivers component are available. Selenium automation scripts can be written in many different languages as long as language bindings in the WebDriver are available. In addition, automation tests can be run on multiple machines and browsers at the same time by including a Selenium Server or Remote WebDriver.
- Open for extension. The Selenium architecture enables possible extensions of language bindings by supporting new test scripting languages or Drivers for new browsers.
- Open for integration with a test automation framework. As shown in the diagram below, a new test automation framework can be built on top of Selenium by using it as an engine for executing scripts for Web automation.
- Developer friendly. As Selenium supports multiple languages, developers can use their most comfortable language to write automation scripts. If needed, they can also build and integrate a binding library in the WebDriver component to support a new scripting language. Developers have the freedom to write code for automation as if they deal with code of the target application under test.
The Need for a Selenium Alternative Solution
However, the advantages of Selenium in supporting programming are actually its disadvantages when looking at the perspective of those who do not possess programming skills or advanced technical skills. Many testers and business analysts, for example, view Selenium as an obstacle for starting their test automation efforts. Knowledge and experience in programming become necessary to effectively build and write tests effectively using Selenium. Hence, it is a steep learning curve for many testers to use Selenium directly.
Due to the lack of many components for a comprehensive automation project, such as reporting and logging, teams have to possess expertise and experience to build, customize, and maintain a Selenium-based tool for their projects. Without thorough planning and architecting, such a framework is not reusable across projects.
Selenium also lacks mechanisms for separating automation scripts from test data, which results in high maintenance cost of test scripts and difficulty in the test script and test data reusability. There is also a lack of capability for managing and organizing test assets such as test scripts, data, and test objects.
These constraints explain the strong emergence of Selenium-based tools in the software test automation market in the last few years. Teams and businesses need a solution that offers out-of-the-box testing capabilities, without having to build up their own Selenium-based framework to begin their automation journey right away.
The Architecture of Selenium-based Test Frameworks
A number of test automation frameworks have been built on top of Selenium. These frameworks try to address many limitations of Selenium, including the lack of modules for reporting, logging, monitoring, and reusing test automation assets. Importantly, these frameworks help address the obstacle of building and starting the automation effort using Selenium. All drivers, dependencies, and libraries needed for automation are included in the framework.
The diagram below presents various components of a typical test framework that uses Selenium as its test execution engine. Core components of this framework consist of Common Libraries, Report and Logging, Data Management and Connectivity, Test Organization and Management, Monitoring, Test Execution, and Scheduler. Data is stored in databases, files, or internal data structures separately from test scripts. An open test framework also allows Application Lifecycle Management (ALM) extensions for integrating test activities and assets into the whole ALM process.
Many existing automation tools implement this Selenium-based framework. Katalon Studio, CrossBrowserTesting, QMetry Automation Studio, Lambda Test, and Sauce Labs are just a few examples of such tools. Many of these tools go further by integrating Appium as an engine for test automation of mobile apps to support both web and mobile automation in a single tool.
This framework does not come by without challenges for automation testers. One of which involves sacrificing the flexibility of choosing a preferred language as Selenium offers. A tool implementing this framework may not support all languages as does Selenium. Hence, testers have to learn the language supported by the tool.
Another challenge is concerning the cost of migrating test scripts, data, and other test assets from one tool to another. The mismatch in organizing test assets between tools makes it difficult for migration. Fortunately, this migration concern is addressed in many comprehensive tools.
Going codeless for test automation with Katalon Studio
Katalon Studio is a test automation tool built on top of Selenium with an IDE, yet it requires little to no programming skills from users to be able to get started with testing.
It implements all capabilities of the test framework discussed above while extending test environments to mobile apps by integrating Appium. In addition, Katalon Studio also allows users to migrate almost everything from Selenium.
The tool offers a wide test coverage on all environments — web, mobile, API, and desktop testing on all platforms and operating systems. You can use the ready-made project templates, keywords libraries, and object repositories available along with the tool to get started with automation effortlessly. Users can extend testing even further with Katalon’s built-in scripting mode and reporting tool for a more comprehensive test project.
It is clear that the nature of testing with Selenium and Katalon Studio differs to a certain level, yet each tool will fit into the needs and goals of testing for different teams. With the movement towards Agile culture is rising in recent years, codeless testing tools would be a better choice to move fast with guaranteed quality.
This article discusses the Selenium WebDriver architecture to offer explanations for the dominance of this framework in the Web automation landscape. Simple, robust, loosely coupled, and open are key characteristics of the architecture. These characteristics lead to its advantages, such as cross-platform, cross-language, and open for extension. The framework’s limitations come from its design, but it can be addressed by building test automation frameworks and tools.
Codeless testing tools, on the other hand, are the new generation of automation tools that effectively solve the challenges of the steep learning curve and the demand for advanced skill sets of Selenium. With the latest new feature that allows for seamless migration of Selenium test scripts to Katalon Studio, this could be the right transition to simplify testing and maximize the values of test automation for teams and their businesses.Trigger modal