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. We will start with the basics of Selenium and then as the tutorial progresses, we will move to the more advanced stuff.
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.
- Selenium Introduction – Introduction to Selenium, its different components, advantages, and limitations.
- Selenium WebDriver Setup – Java, Eclipse and Selenium setup with a sample script for validation.
- Launching Browsers in Selenium – Commands and sample scripts to launch different browsers.
- Finding web elements in Selenium – Locate web elements using Firebug and Selenium locators.
- Selenium WebDriver Basic Commands – Some of the most commonly used WebDriver commands.
- Waits in Selenium – Learn about waits in Selenium for synchronizing 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.
- CSS Locators – Learn how to locate elements using their CSS (Styling)
- XPath Locators – Learn how to identify elements using XPath (XML navigation)
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 automation.
- Handling dropdowns in Selenium WebDriver
- Right Click in Selenium
- Double Click in Selenium
- Mouse hover in Selenium
- Drag and Drop in Selenium
- Handling Alerts in Selenium WebDriver
- Scroll a Webpage in Selenium
- Navigate Back and Forward in the Browser history
- Refresh a webpage in Selenium
- Maximize and minimize browser in Selenium
- Resize browser window in Selenium
- Screenshot of Failing Tests in Selenium
- Desired Capabilities in Selenium
- Handling Cookies in Selenium
- Executing JavaScript Code in Selenium
- Press ENTER, Function and other non-text keys in Selenium
- Keyboard Interactions in Selenium
- Mouse Interactions in Selenium
- HtmlUnitDriver – Headless Browser in Selenium
- Difference between Assert and Verify
- Difference b/w driver.close() and driver.quit()
- Difference b/w driver.findElement() and driver.findElements()
- Check a checkbox only if it is not already checked
Selenium Framework
Here, we will study some of the widely used automation frameworks and design patterns along with sample scripts for their implementations.
- Data-Driven Framework – A data-driven framework using Selenium and TestNG.
- Page Object Model – An automation design pattern that helps in creating maintainable test suites.
- Page Factory – One of the implementations of Page Object Model(POM) provided by Selenium.
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.
- TestNG Introduction – TestNG, its usage and features.
- Selenium WebDriver with TestNG Sample Script – Creating a basic test in Selenium with TestNG.
- TestNG Annotations – Annotations are basically the tags using which TestNG provides different features.
- Data-Driven Testing in TestNG – Framework in which the test data drives the automation tests.
- Running Selenium Tests in Parallel using TestNG – Reduces the overall test execution time.
- Multi-browser testing in Selenium using TestNG – Sample script to run tests with different browsers.
- Rerun failed tests – TestNG configuration and sample script to retry the failed tests.
- Set Test priority in TestNG – Prioritizing the test cases or setting the order of test case execution.
- Dependency in Tests – Makes execution of one test case dependent on another.
- Soft Assertion in TestNG – To continue code script execution even after assertion statement failure.
- Timeouts in TestNG – Used in scenarios which need to be failed if not completed in a defined time.
Other Selenium Tutorial
- Meaning of WebDriver driver = new FirefoxDriver(); – Behind the scene working of the command.
- 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.
- What is Geckodriver? – Learn about Gecko and GeckoDriver and its association with Mozilla Firefox.
- Handling GeckoDriver exception in Selenium – Resolution of GeckoDriver exception.
Interview Questions
- Top 100 Selenium Interview Questions with Answers – Commonly asked Selenium interview questions.
- TestNG Interview Questions – A comprehensive list of testNG interview questions.