Selenium Tutorials – A Complete guide to master Selenium
Selenium is an automation testing tool used to test web-based applications. It is one of the most popular automation tool available in the market, and there is no other tool which provides as many features and functionalities as selenium do.
Some of the reason it became famous includes – being open source, support for multiple browsers, support for multiple languages, support for multiple platforms, easy to integrate with Testing frameworks and much more.
This tool can be integrated with other tools like TestNG (Testing Framework), AutoIT, Skiuli, etc. Selenium tutorials QA Tech Hub will help you develop an in-depth understanding of the concept.
This online tutorial of Selenium Automation tool will cover all the topics from beginners to advanced level with real-time examples and lots of assignments to practice, starting from Selenium basics, framework development, Working with Selenium Grid and much more.
For better understanding, we recommend you should cover below topics in sequential order.
Before starting with Selenium automation, let us first learn – why Automation testing is necessary for software development, which all are the different tools available for Automation and why selenium is one of the best option available.
Selenium is not just a single tool rather it’s a suite of tools, let us explore more about each tool in detail, how these components become famous and a brief history about each of these components along with their architecture.
After learning different components of selenium let us start with creating the environment for Selenium WebDriver. We will be using Eclipse as an IDE, Java as the platform and programming language and Selenium WebDriver.
We can also create a maven project in eclipse and write all selenium code in there.
As we are done with setting up the environment for Selenium WebDriver, let us start with learning basic APIs with Mozilla Firefox.
Note: Follow this tutorial if you are working with Selenium WebDriver 2.xx and Mozilla Firefox version 46 or below as in Selenium 3.xx there was a significant change which happened with Mozilla Firefox browser. Follow the below tutorial to understand the change.
We will learn how to invoke Mozilla Firefox browser using Gecko Driver using Selenium 3.xx and Mozilla version above 46. This was a significant change happened in Selenium 3.
Chrome Browser is the most widely used browser in the industry, and it is very important to test applications on the Chrome browser. Let us learn how to invoke Chrome browser using selenium.
There are many applications which do not perform efficiently on Internet Explorer, and there are many problems encountered in using this browser with Selenium WebDriver. Let us master those challenges in this tutorial.
To automate the web-based application, it is important to interact with web elements. Selenium provides us with eight identifiers or locators, mastering these is must especially Xpaths and CSS Selector.
Let us learn how to interact with links on a Web Page with some real-time scenarios like how to get URL attribute from a link, how to get the number of links from a Webpage, how to iterate over each link.
One of the most important topics in Selenium WebDriver is learning and mastering XPath locator. In this tutorial, we will learn Absolute Xpath, writing Relative xPath for static and dynamic web elements using functions, operators, and axes.
The components of a form which we frequently interact with are Textbox, Checkbox, Radio button, button, etc. There are many actions which we can perform with these web elements like clicking on an element, writing in a text box, fetching text from web elements, etc. This tutorial covers all these topics in detail.
Tables are one of the important ways to represent data in a structured form. Some of the tables have static data whereas some of the tables are dynamic d in nature. In this tutorial, we will cover how to interact with these tables to fetch data.
The dropdown is one of the important component available on a web page which allows us to select data from many options. There are many operations like selection, deselection, getting options, etc. which can be performed on a dropdown.
In Website like e-commerce, many a time we come across a situation where products are listed in lists (HTML lists). This tutorial will cover different scenarios to work with ordered and unordered lists. The main focus will be on writing dynamic XPath.
One of the biggest challenge an automation engineer face is to synchronize execution speed or performance of selenium code with that of the application under test. To handle this situation, Selenium provides us with many wait commands like Implicit wait, Explicit wait (Conditional wait) and Page Load timeout.
IFrame or Frame is like a page embedded in another page. They are used when there is a requirement of one section of a page to be separated out from the rest. Selenium cannot interact directly with the elements of the frame, for that, it has to switch to that frame and then only elements can be identified.
There are many links on a web page, when we click on them, a page opens up in a new tab or a new window. When automating such scenario using selenium, the control does not go automatically to this new page. We have to write code to switch to this new window, and then only operations on this new window can be performed.
Alerts are like messages or warning which pops up on the screen on performing certain operations. When an alert comes up, we cannot do normal activities on the page. We have to switch to that alert first – accept or reject this alert and then only activities comes back to normal.
Validating means a comparison between the expected and actual result. Validation on a web page can be to verify that web elements are rendered correctly or not, the title of the page is as expected or not, hidden elements are hidden or not, etc. These validations are necessary to give a verdict whether a test case is pass or fail.
Mouse Hover is a mouse operation perform to take focus on a particular web element on a page. It is an important feature provided in E-commerce like Websites where submenus appear when you mouse hover over a component of the main menu.
As web pages are becoming more and more user-friendly, there is one mouse operation which is gaining popularity – Drag and Drop. It means dragging a WebElement from one location to another.
Cookies are physical files which are stored by your browsers to improve the browser history. These cookies sometimes create issues in testing an application and sometimes they are very helpful. It is important to understand how cookies can be handled – addition, deletion and getting cookies
Whenever we execute a test case using Selenium scripts or any other automation tool, and it fails, it’s important to take the screenshot so that this screenshot can be used later on when we inspect the cause of its failure. It helps us to debug and identify the problem by seeing the screenshot.
Exception Handling is very important when we write automation scripts. There are many exceptions which occur in selenium like element not found Exception, Element not visible exception, etc. In this tutorial, we will learn how to handle or prevent these exceptions for a flawless execution
While testing any web application, many a time we come across a situation where we have to interact with “Windows-based UI” elements. One of the most common scenarios is while uploading or downloading an image file. Selenium cannot interact with Windows-based elements. AutoIt can help in that, in this tutorial we will learn how to integrated selenium with AutoIt.
ChromeOptions is new concept added in Selenium WebDriver starting from Selenium version 3.6.0 which is used for customizing ChromeDriver session.
Selenium Grid is another component of Selenium Suite which is used for Parallel Execution of test cases on different machines. In this tutorial, we will learn how to set up environment for Selenium Grid and will run a simple call flow.
One of the features which automation developers look for is reading data from an excel sheet. Here, we will learn how to integrate Microsoft Excel sheet with Selenium WebDriver. Selenium does not provide any inbuilt feature to work with excel. So, we will take help of one most famous third-party tool called POI jar files provided by Apache.
By this time you all must have a good command in Selenium as a subject. If you want to learn more about different Classes, Interface, Methods in Selenium WebDriver. You can go through Java Documentation of Selenium WebDriver.
Now let us learn – “How to write effective, maintainable and reusable code?”
Upcoming topics will mainly focus on Design patterns; Designing frameworks; Creating effective reports, etc.
Design patterns help developers to write effective and maintainable code. In this tutorial, we will learn one of the famous design patterns know as POM (Page Object Model) used in the Frameworks intended for Automation with Selenium WebDriver.
Selenium provides us with an enhanced way of implementing POM(Page Object Model) i.e. Page Factory. Here, we have applied an example using Page Factory.
A framework is the core structure of any environment. It can be a testing environment, or designing a web application or developing some windows based application. Developing a framework means defining a standard of writing codes. Without a framework, the code written will be in a haphazard manner, which is neither reusable nor readable.
In Data Driven framework the test data is kept separate from the actual scripts. So, if any change occurs in test data or if you have to verify the script with multiple sets of experimental data, then no change is required in the script. This data can be kept in some external file like Excel Sheet or CSV file, or some database.
In this tutorial, we will design Hybrid driven framework from scratch. The Hybrid framework is one which has a flavor of Data Driven as well Keyword Driven.
PS: This is not the end of the tutorials, keep tracking this Section for latest and updated topics on Selenium. For any questions, queries, and comments. Feel free to write us at firstname.lastname@example.org or email@example.com. You can also join our weekly newsletter for latest updates.