Tips and tricks Best practice guides, FAQ & more
In this guide, you'll get an introduction to Selenium.
You'll learn about the broad benefits of using Selenium for automated web application testing.
We'll explain what it to succeed with Selenium - from the skills, effort and resources needed.
And we'll explain how to use Selenium and what you can use it for.
If you're on the hunt for a tool that allows you to work with Selenium without coding, skip to the end.
Selenium automates web applications and drives web browser behavior such as clicking on buttons and typing into fields.
You can do anything a regular user can do in a web browser (Chrome, Firefox or Internet Explorer).
But there's a catch. You have to be able to code to use Selenium.
It's why programmers are normally tasked with building Selenium tests.
There's a few programming languages available too - like Python, Java and C#. Using these programming languages, you can build test that load web pages, perform required actions and check for expected results.
Related reading: What is Selenium Testing?
In the picture below, you can see an example of what a Selenium test looks like (source: Sauce Labs).
In this example, Selenium loads the “www.SauceLabs.com” web page and looks for a button that links to the “/beta/login” URL. It then checks that the text inside the button says “Sign In”.
Once programmed, Selenium test scripts can be executed on any operating system, browser type or version, and on a variety of environments, including:
Selenium consists of a suite of tools. One being WebDriver.
WebDriver is a framework that accepts commands and sends it to a browser. It what testers and developers interface with when they create and execute.
Read more about what Selenium WebDriver is here.
Why do people choose Selenium testing in the first place?
Related reading: Selenium automation - what does it require?
Businesses are release new software and features faster than ever before. They're not just releasing applications to consumers (think Spotify and Teams). They're also adding new features to their CRM applications (think Salesforce and SAP).
Both of these types of software - consumer and operational - must be tested. But it is the process of testing software that is putting an immense pressure on QA departments.
It's in the best interest of a business to get their software to market as fast and at as high quality as possible.
And testing with tools like Selenium gets them there. It helps you and your business ensure reliable and consistent software behavior.
For automation of web application testing, Selenium has many benefits:
But with Selenium's many benefits, there also comes some downsides.
For example, while automating your regression tests using Selenium, you're supposed to be able to get your software to market faster.
At least, this is what we've been told.
The reality is, Selenium testing doesn't always get you to that point.
While Selenium’s greatest power is its ability to give programmers “raw” access to the browser. It also means that a programmer should have extensive coding experience to write and structure the code in a way that is maintainable.
Even then, maintenance can be challenging. For example, every time a browser updates, your web browser and Selenium WebDriver become out of sync. It's only once you've updated your Selenium tests that they will start working again.
Selenium only drives the browser; it does not record results or have any reporting capabilities – that’s for the programmer to create and maintain, typically by integrating the Selenium code with an Application Lifecycle Management system such as Azure DevOps.
In inexperienced hands, Selenium code can lead to an unmaintainable and unscalable mess.
Find out if Selenium if the right test automation tool for you.
"In inexperienced hands, Selenium code can lead to an unmaintainable and unscalable mess"
Selenium can be used to automate testing of any web application - from Linux-based web applications built in Java, Python or Node.js to Windows-based .NET web apps.
It's frequently used for automated testing of web-based enterprise applications such as ServiceNow, Salesforce, Oracle, SharePoint, Sitecore, SAP and many others.
While Selenium works well with web browsers. It does have some blind spots.
Or browser features, such as turning extensions on and off.
For an enterprise, this can be challenging, as they typically need to have tests that run across different applications types.
For instance, a back-office application built for Windows desktops in WPF (Microsoft .NET) might be needed to setup an account, after which a web front-end needs to be validated, alongside records produced in a mainframe or maybe on a Citrix screen.
In sum, if you're looking to automate any non-web-based applications, you will need to either use Selenium in orchestration with another automation tool, or you need an alternative solution.
Find out why Selenium doesn't work for desktop test automation, and how to find the right testing tool for your automation needs.
All of these examples have a lot of things in common. As explained in the Sauce Labs’ introduction to Selenium, there are six basic steps in creating a Selenium script for test automation:
It sounds straightforward, but it’s clear from the example in section 2 above that it’s complicated and time-consuming to write code.
In this comparison of Leapwork vs. Selenium Web Automation, it becomes clear that the biggest problem facing non-professional programmers isn’t actually getting the automation code to work initially. It’s the maintenance of the scripts, particularly in an enterprise environment.
(The Leapwork vs. Selenium comparison takes into account the following factors: Usability and adoption, documentation and governance, the applications supported, and the test execution ad integrations.)
In addition to writing test automation scripts, making Selenium work as a test automation tool also requires:
Next, we’ll show how you can use a single tool across all application types, without having to write a single line of code.
Selenium can be used to execute the following types of actions:
But when testing goes into action, and you're tasked with creating end-to-end tests in Selenium, or run a regression suite across more than one type of application, Selenium might become tricky to use.
But if you use Selenium under the hood of a codeless solution. Things change. Imagine if these Selenium actions were represented by building blocks that could simply be wired up together to create automation flows.
This is possible with Leapwork. We’ve built a next-generation visual language that everyone understands, and which uses Selenium under the hood. It's the alternative to Selenium that doesn't require any coding.
Related reading: Codeless Selenium: How to Automate with Selenium without Coding
Below is an example of codeless web automation. It’s a simple flow that creates contacts in Salesforce from an Excel spreadsheet, and then validates that each contact is correctly stored:
Related reading: Can You Automate Salesforce with Selenium?
A flow like this takes only minutes to set up. Had the automation been coded, it could take hours or even days to create.
In this whitepaper, we list the pros and cons of Selenium for Salesforce, and how to increase your Salesforce test automation efficiently and with lower maintenance.
The following video is a side-by-side comparison of code-based Selenium vs. no-code Leapwork.
"We’ve built a next-generation visual language that everyone understands, and which uses Selenium under the hood."
Capture elements once: Point and click to capture any button, image, or field on your screen. Leapwork’s smart algorithms automatically find the best way to locate it again in the future.
No more time wasted waiting: Nobody likes to wait. With implicit wait controls, Leapwork flows automatically wait for the right object to be found before executing the next step in your test case.
Gives an overview of test steps: Flowcharts give you a clear overview of your test suite, making it easier to set up and maintain tests.
Design re-usable components: Reduce the maintenance workload by building sub-flows for commonly used processes and steps. Edit sub-flows in one place and use them across teams and projects.
Test across browsers and devices: Test applications in any operating system, any desktop or mobile device, and any browser version. Leapwork comes with built-in Sauce Labs and BrowserStack cloud integrations.
Run tests anywhere, anytime: Automated tests can run on local, remote, and virtual machines, in closed networks, and in the cloud. Timing and frequency of run schedules are completely customizable.
Support continuous delivery: Plug Leapwork into your CI/CD pipeline using our public REST API. Leapwork comes with ready-to-use plugins for the most common DevOps tools and orchestrators.
Reports and live dashboards: Make the right decisions with powerful live dashboards and reports. Reports are exportable and fully customizable with filtering and grouping options.
Document everything: Test cases are automatically documented with video recordings, text logs, and time stamps. All actions and events are recorded in audit trails. Replay and inspect for fast troubleshooting.
Collaborate on test automation: Team work is about working better together. With project asset sharing, easy hand-over, user roles, and access profiles, collaboration becomes easier.
Stay in control of systems: Every single action in Leapwork is encrypted and tamper-proof – and automatically tracked in audit logs. Roll back to previous versions of automation flows with revision history.
Software testing can be difficult and costly. Test automation helps increase productivity, reduce risk, and reduce costs in connection with testing.
The Selenium framework is a popular choice for web automation. However, testing with Selenium requires extensive programming skill, and it's difficult to maintain and scale. It is also limited to web application automation, and can not be used across technologies such as desktop, virtual or legacy.
With Leapwork, a codeless Selenium automation platform, you can automate across all technologies without writing a single line of code.