Selenium is one of the most widely used open-source Web UI automation testing tools. It supports the automation of websites across different browsers, platforms, and programming languages. Our Selenium tutorials are designed specifically for beginners with little to no prior knowledge of Selenium or automation. We will start with the basics and then as the tutorial progresses, we will move to the more advanced stuff like multi-browser testing, running tests in parallel, automation frameworks, etc.
Selenium Tutorial for Beginners
This section covers the introduction and setup part of Selenium along with the usage of basic Selenium commands that one has to use during the automation of web-based applications.
Chapter#1 – Selenium Introduction
Introduction to Selenium, its different components, advantages, and limitations.
Chapter#2 – Selenium WebDriver Setup
Java, Eclipse, and WebDriver set up with a sample script for validation.
Chapter#3 – Launching Browsers in Selenium
Commands and sample scripts to launch different browsers.
Chapter#4 – Finding web elements in Selenium
Locate web elements in Selenium using Firebug or Chrome Developer tool.
Chapter#5 – Selenium WebDriver Basic Commands
Some of the most commonly used WebDriver commands and their usage.
Chapter#6 – Waits in Selenium
Learn about waits in Selenium for synchronizing the different user actions.
CSS and XPath Locator Tutorial
For effectively working with different elements, especially the dynamic elements, one should know how to create complex element locators. In the below two tutorials, we will study the CSS and Xpath locators which help us in creating locating complex elements.
Chapter#7 – CSS Locators [Must Read]
Learn how to locate elements using their CSS (Cascading Style Sheets)
Chapter#8 – XPath Locators [Must Read]
Learn how to locate elements using XPath (XML path)
Selenium WebDriver with Java Tutorial
The below tutorials will help you with code snippets and examples for some of the most commonly performed actions in test automation. Here, we are using Java language with Selenium. If you no prior experience of Java then you can learn the basics of Java from W3School.
Chapter#9 – Handling Dropdowns in Selenium
Learn how to interact with dropdown elements.
Chapter#10 – Right Click in Selenium
Learn how to simulate mouse right-click action.
Chapter#11 – Double Click in Selenium
Learn how to simulate mouse double-click action.
Chapter#12 – Mouse hover in Selenium
Learn how to simulate mouse hover action.
Chapter#13 – Drag and Drop in Selenium
Drag and Drop web elements using Actions class in Selenium.
Chapter#14 – Handling Alerts in Selenium
Accept – Dismiss alerts or pop-ups in Selenium.
Chapter#15 – Press ENTER, Function and other non-text keys
Simulate keyboard keypress events for non-text keys like Enter, Ctrl, Alt, etc.
Chapter#16 – Scroll a Webpage in Selenium
Learn how to scroll up and down to a cordinate or specific element in Selenium.
Chapter#17 – Refresh a webpage in Selenium
Learn all the ways to refresh a web page in Selenium [5 different ways]
Chapter#18 – Maximize and minimize the Browser
Selenium commands to maximize and minimize the browser window.
Chapter#19 – Resize the browser window
Learn the resizing of the browser window in Selenium WebDriver.
Chapter#20 – Navigate Back and Forward in the Browser history
Navigate back and forward using driver.navigate() command.
Chapter#21 – Keyboard Interactions in Selenium
Learn about KeyDown, KeyUp, and sendKeys commands.
Chapter#22 – Mouse Interactions in Selenium
Learn about different mouse interaction commands along with code snippets.
Selenium With TestNG Tutorial
Selenium is just an automation tool, in order to make validations, pass-fail a test case, create test reports, etc, we need a testing framework. In the below tutorials, we will study one such framework/library – TestNG.
Chapter#24 – TestNG Introduction
What is TestNG? What are its different features?
Chapter#25 – Selenium WebDriver with TestNG Sample Script
Creating a basic test in Selenium with TestNG.
Chapter#26 – TestNG Annotations
Annotations are basically the tags using which TestNG provides different features.
Chapter#27 – Data-Driven Testing in TestNG
Framework in which the test data drives the automation tests.
Chapter#28 – Running Tests in Parallel using TestNG
Reduces the overall test execution time.
Chapter#29 – Multi-browser testing using TestNG
Sample script to run tests with different browsers.
Chapter#30 – Rerun failed tests
TestNG configuration and sample script to retry the failed tests.
Chapter#31 – Set Test priority in TestNG
Prioritizing the test cases or setting the order of test case execution.
Chapter#32 – Dependency in TestsNG
Makes execution of one test case dependent on another.
Chapter#33 – Soft Assertion in TestNG
To continue code script execution even after assertion statement failure.
Chapter#34 – Timeouts in TestNG
Used in scenarios which need to be failed if not completed in a defined time.
Here, we will study some of the widely used automation frameworks and design patterns along with sample scripts for their implementations.
Chapter#35 – Data-Driven Framework
A data-driven framework using Selenium and TestNG.
Chapter#36 – Page Object Model
An automation design pattern that helps in creating maintainable test suites.
Chapter#37 – Page Factory
One of the implementations of the Page Object Model(POM) provided by Selenium.
Other Selenium Tutorial
- Meaning of WebDriver driver = new FirefoxDriver(); – Behind the scene working of the command.
- Handling Cookies in Selenium
- Check if an element is present on a web page – Code snippet to check the element’s presence.
- Wait for the page to load – Code snippet to wait for the page to load before interacting with the web elements.
- Open a new tab in Selenium – Code snippet to open a new tab in Selenium.
- Get all links present on a web page – Script to scrap the links present on a web page.
- Exceptions in Selenium WebDriver – List and explanation of all the Selenium exceptions.
- Screenshot of Failing Tests – Save screenshots of failing tests using Selenium and TestNG
- Desired Capabilities in Selenium – Learn about desired capabilities and their usage.
- Difference between Assert and Verify – Know the difference between the two validation mechanisms in testing frameworks.
- Difference b/w driver.close() and driver.quit() – Know the difference between the two ways to close browsers windows.
- Difference b/w driver.findElement() and driver.findElements() – Difference between the two along with their usage.
- HtmlUnitDriver – Headless Browser in Selenium – Learn about the Headless browser and its usage.
- Check a checkbox only if it is not already checked – Code snippet to check if a checkbox is checked or not.
- What is Geckodriver? – Learn about Gecko and GeckoDriver and its association with Mozilla Firefox.
- Handling GeckoDriver exception in Selenium – Resolution of GeckoDriver exception.
Selenium Interview Questions
- Top 100 Selenium Interview Questions with Answers – Commonly asked Selenium interview questions.
- TestNG Interview Questions – A comprehensive list of testNG interview questions.
Database Automation Tutorials
Selenium is an open-source and free test automation tool using which we can automate web-based applications.
Yes, if you have basic programming knowledge, you can learn Selenium on your own, just start from chapter-1 of our course. Our course is completely free and designed for complete beginners.
In order to learn Selenium WebDriver, you need to have knowledge of the languages supported by Selenium like – Java, Python, Ruby, etc. If you have no programming language knowledge then you can either start learning any language or you can pick an automation tool that requires no or minimal coding like – Katalon Studio.
You can learn basic website automation in a couple of days only but for complete Selenium features and test automation framework knowledge, it will take you about 2-3 weeks of consistent study and practice.