When we are talking about test automation in a group of friends, we always include Selenium in the conversation, because Selenium is one of the best and loved tools for test automation. Both testers and developers enjoy using Selenium. Even though there are a lot of tools available in the market, why is Selenium still the most known and used tool? In this article, we are going to discuss what Selenium is, why you should use Selenium, and the pros and cons of using Selenium.
What Is Selenium?
Selenium is a free (open-source) test automation framework used to automate tests in order to validate web applications. Selenium accepts commands and sends them to a browser, and it is implemented through a specific driver to each browser.
Selenium is composed of three tools:
- Selenium IDE is the tool used to record and playback tests. It is a Chrome and Firefox plugin where you can record your tests in an easy way. The plugin records the user actions in the browser, using Selenium commands, and then you can use the same plugin to execute the test.
- Selenium WebDriver uses the browser APIs to control browsers, sending commands to them to run tests. It works like a real user that is using the browser, interacting with it.
- Selenium Grid is a tool that allows test case execution across different platforms. It makes it possible to run tests on multiple operating systems and browsers with various combinations.
Selenium is used by a wide community of testers and developers across the world which makes Selenium one of the most popular test automation tools.
When should we use Selenium?
Selenium can be used to automate plenty of test types, such as:
- Compatibility Testing
- Performance Testing
- Integration Testing
- System Testing
- End-to-end Testing
- Regression Testing
- Smoke Testing
- Sanity Testing
However, Selenium could be used whenever you want to make basic tests in your system. Imagine that you want to access an URL, fill in a form, submit it, and verify if the submission was sent successfully, this can be done using Selenium. You can also use Selenium if you want to verify how your system works in different OS-browser combinations.
Nowadays, we are living in an Agile era, where it is not possible anymore to spend a lot of days running basic manual testing that could be done by an automation script. We must build and deliver new features daily, so, we must test daily. In some cases, companies have to deliver new versions more than once a day, so we must use automation tests in order to make it possible.
It is recommended to have automated tests since the early stages of a software development lifecycle, during the basic features validation, the integration tests between system modules, the acceptance tests on each feature, and in production tests. We can use Selenium during all test phases, in order to benefit from its capabilities and make higher quality products, as we test more in less time.
What are the pros of Selenium? ✅
When choosing a tool, we must analyze its advantages and compare it with the advantages of other tools. In this section, we will understand the greater advantages of Selenium.
It is free and open-source
The main reason that everyone loves Selenium is that it is totally free and open-source. This makes it possible for companies of all sizes to use Selenium in their automated tests, there are no costs and the community is always creating new capabilities, since it is open-source.
Supports multiple platforms, browsers, and languages
Another great thing in Selenium is the long list of browsers, platforms, and languages it supports. Nothing better than a tool that you can automate tests to the most used browsers and operating systems, and even better, you do not need to learn another language to use Selenium, you can continue to use your favorite language, any of the ones you already know.
Below there is a list of all Selenium compatibilities:
Another important benefit is that Selenium can be fully integrated with CI/CD tools like Jenkins, Azure DevOps, Bamboo, Travis CI, Circle CI, GitLab, and plenty of other tools. This is important because one of the best practices in test automation is to use tools to automate test execution, within the development pipelines.
Supports mobile testing
Using Selenium integrated with tools like Appium, it is possible to test mobile devices. Appium is based on Selenium allowing you to use the same capabilities as if you were automating a web page. Selenium with Appium can be used to automate Android, iOS and Windows Phone applications, even if it is a native, hybrid, or mobile web app.
With Selenium Grid, you can run tests in parallel and control the execution at a central point. This is a great thing because it is known that execution time for web tests increases over time, and with parallel execution, we can have a very interesting gain from the moment that our test suite is very large.
As said, Selenium is a common topic when talking about test automation. Almost 30% of automation tools are based on Selenium (take for example TestProject‘s 100% free test automation platform which bundles up Selenium and Appium for you with a bunch of added functionalities!), and more than 50k companies are currently using Selenium in their test automation frameworks. So, we have a huge number of professionals involved daily with Selenium, making the community always active through blog posts, courses, forum questions, and resources created to help each other.
What are the cons of Selenium? ❌
Despite being a powerful tool, Selenium has some disadvantages that it is important to know in order to help in decision-making moments.
Only supports web applications
Selenium only works for web test automation. Although we can do everything within a browser using Selenium, we can only use Selenium to do things within the browser. It is not possible to automate desktop applications, for instance.
The best way to use Selenium is through Selenium WebDriver. Learning how to use Selenium WebDriver is not easy and will not happens overnight 🌛 There are a lot of things that should be learned in order to start automating tests with Selenium WebDriver. Nowadays, test automation is following a path for codeless tools, that is, without needing any programming knowledge. Selenium IDE, which could be the alternative for that, because it is an easy tool to be used in test automation, it is only available to Chrome and Firefox.
No built-in image comparison
Selenium does not have a built-in image comparison that it is important to validate that images that should be displayed in the application are there, and are correctly shown. To do this, third-party libraries must be used to have this capability. Alternatively, you have tools such as TestProject that are built on top of Selenium and empower its native functionalities with out-of-the-box features and over 1,500 ready-to-use automation actions such as Image Comparison actions you can explore here.
No built-in reporting capabilities
A basic feature that Selenium does not have is reporting. All testers or developers need to create reports with test automation results in order to present them to managers, contractors, customers, and stakeholders. To have this capability in Selenium, we also must integrate with third-party libraries and frameworks in order to collect execution data and generate a test report. Tools like TestProject provides such Selenium dashboards and reporting features out-of-the-box, at no cost and without any need to integrate 3rd party tools.
Expensive test maintenance
The difficulty here is about locators that we should use in our test automation scripts. Once a locator is modified, we always need to update our test code. Solutions with AI tools can better handle this type of situation, making the maintenance cost of test scripts cheaper.
No tech support
Even though there is a large community of professionals working with Selenium, looking for solutions is not simple. The lack of a supportive company behind Selenium may be a difficulty for beginners.
Without any doubt, Selenium is the most widely used test automation tool in the world. The advantages and features that the framework provides are very interesting, and thousands of companies around the world are using Selenium at this moment to automate their testing.
There are tools such as TestProject that allow the use of Selenium APIs in tests created on the platform, which make the use easy, as it does not require the installation of Selenium and several other tools, such as the Appium for mobile tests, and reporting libraries because TestProject already has them built-in. In addition, using Selenium within TestProject gives you the possibility to continue using any language you love with OpenSDK and a way of working that you are already used to with Selenium, but obtaining several other benefits and extra features.
Learning Selenium is a good thing that you can do right now! What are you waiting for? 😎