For many organizations that work in the web app development space, Selenium is the tool of choice for automated testing. Well, there’s a reason for that: Selenium is indeed a powerful and useful tool, and there are plenty of good things we can say about it. Unfortunately, every rose has its thorn and Selenium is certainly no exception.
What Is Selenium?
Selenium is a web automation tool. Saying that most people and organizations use it for testing would be a safe bet. However, there’s really no requirement that you use Selenium only for that. You could use it, for instance, to automate some tedious administrative tasks you have to perform every week.
Selenium comes in mostly two variations: Selenium WebDriver and Selenium IDE. The WebDriver version is a robust framework you can interact with programmatically using a variety of programming languages. Selenium IDE is a browser extension you can use to do record-and-playback testing. In this article, we’re mostly concerned about the WebDriver version.
Why Is Selenium Used?
When it comes to testing, people use Selenium because it empowers them to do automated testing. Why do automated testing, then?
Well, it all boils down to the fact that software is complicated and prone to regressions. That is, adding new features or fixing defects can cause existing features to stop working. That’s why it is so essential to have comprehensive automated testing because completely testing the application, manually, after each tiny change is extremely impractical.
When it comes to Selenium specifically, it allows organizations to simulate testing of user interactions with their web applications, across different browsers.
What Are the Benefits of Selenium Automation?
Nobody wants to learn a new programming language just to use a testing automation tool.
Selenium communicates with browsers using drivers, which come in different versions according to the browser versions. So, as long as you have the correct driver, you should be able to work with your preferred browser since Selenium supports all of the major browsers, such as Chrome/Chromium, Firefox, Safari, Edge, and Opera.
Going one step further, Selenium is also cross-platform. You can use it on Windows, Mac OS, or your favorite Linux distribution. It’s possible to create tests in one platform and execute them in another one.
Selenium is an open-source tool that’s been around for quite a while. It has great community support you can count on, not only with regular updates and upgrades but also with comprehensive documentation and many other learning resources.
Here’s another area where Selenium shines: integrations. Since third-party plugins can extend Selenium’s functionality, you can use that to your advantage. You can use one of the many supported or unsupported plugins that already exist or create your own.
Parallel Test Execution
Selenium supports the parallel execution of tests on multiple machines. Through the use of Selenium Grid, users can perform tests across a variety of browsers and platforms, managing different browsers and their configurations in a centralized way.
What Are the Disadvantages of Selenium?
High Test Maintenance
One of the main disadvantages of working with Selenium is that it often leads to fragile tests. Selenium tests will rely on a single, rigid element identifier. Changes to the application, especially those in elements’ identifiers will break Selenium tests. This stops releases in their tracks as teams try to diagnose failures, fix tests, and rerun them.
Sometimes this happens when Selenium tries to interact with an element before it’s been rendered to the page. When that’s the case, there’s a known solution: use Selenium’s wait capabilities. However, when the problem happens because a developer actually changed the identification of a given element, there’s not much you can do. There are testing tools that rely on smarter strategies to define locators for page elements, leading to tests that are more robust. Selenium isn’t one of them.
Selenium can be a powerful tool, but it’s definitely not an easy one to master. We live in an era when software testing is the responsibility of everyone, so teams and organizations will often prefer testing tools that don’t require coding knowledge.
Selenium IDE is a browser plugin you can use to record interactions with browsers and save them so you can play them back later. Unfortunately, Selenium IDE comes with some severe limitations when compared to the “full” Selenium WebDriver:
- It’s only available as extensions for Chrome and Firefox.
- It doesn’t offer easy ways to wait when performing tests.
- The tests created will be typically brittle since IDs can change.
So, when it comes to the learning curve of Selenium, you’re often between a rock-and-a-hard-place. Either you go with Selenium WebDriver, which is powerful but hard to learn, or you choose IDE, which is simpler but has severe limitations.
No Built-in Reporting Capabilities
Understanding the status of your testing is key to knowing release readiness. When it comes to a testing strategy, compelling visualizations are a powerful communication tool, especially when it comes to business/non-technical stakeholders. So reporting capabilities are key in a test automation tool, and Selenium, unfortunately, lacks that natively.
No Reliable Tech Support
Selenium’s open-source nature can be a double-edged sword. On the one hand, you can find awesome community support. On the other hand, that’s all you have. When that’s not enough, you can’t pick up the phone and call a support team that will have your problem sorted out as fast as possible.
What’s the biggest disadvantage of Selenium? It’s probably its higher cost. But wait a minute. Didn’t we say Selenium is free?
Well, it is an open-source solution, meaning you don’t pay a license to start using it. That doesn’t mean it’s really free. What you have to take into account—not only with Selenium but with every tool—is the total cost of ownership (TCO).
Due to the steep learning curve, lack of tech support, the requirement of using additional tools for certain functionalities, and other problems, the total cost you pay for Selenium ends up being way higher than the zero you see on its price tag.
There’s also an opportunity cost for using Selenium. If your team is taking hours to write each test, they aren’t writing code to enhance your application. If they are spending time fixing flaky tests, they aren’t spending time innovating. If they are spending time creating manual reports, they aren’t planning the next feature release.
Selenium Pros and Cons: Understand Them to Make Informed Decisions
When it comes to testing automation, Selenium is one of the big names out there. It’s an open-source tool with a huge community, many integrations, and powerful capabilities. Selenium is not a testing silver bullet, though. Like any other tool, it comes with its share of downsides.
In this post, we gave you a look at some of the most important pros and cons of Selenium. Now you’re more prepared to make an educated decision on whether or not Selenium is the right tool for you and your organization.
If you end up deciding that Selenium’s pain points are not for you, then look for tools that can relieve such pains. More specifically, we’d invite you to take a look at Testim, an AI-powered test automation tool that uses smart strategies to generate reliable and robust test suites.