Selenium Tutorials for Beginners - Step by Step

Welcome to the Exciting world of Selenium

If you are new to selenium, here is a step by step plan for getting started with Selenium. We have many examples (and will keep adding) which helps you to learn, practice and became an expert in automation using selenium and prepared to implement a framework for your project.

Lets Get Started with Selenium Webdriver

Selenium is a web Automation tool which can be used to automate web browsers across many browsers and operating systems.

Before jumping onto selenium in details, you should have a minimal knowledge of Java as going forward all the examples will be using java as programming language and near future we will add other languages for scripting and Basic knowledge on HTML will help to create effective scripts and construct reliable css/xpaths.

If you're not expert in java language or new to it, nothing to worry much, but your progress depends on how comfortable your are with the programming language that you choose.

In order to write our test scripts, you may need an IDE / editor. There are many open source editors available in the market. Here we will be mostly using Eclipse/IntelliJ.

## Prerequisites and Installations ##
1. Download and Install Java 8 (you’ll need to have Java 8 to use Selenium 3)
2. Download IDE / editor (To Create and run your tests)
3. Download Selenium Webdriver.

Before starting to write your first test, know more details about selenium - Introduction to selenium And also Why Automation Testing is required? to know why we go automation (If you are new to automation).

Starting with Selenium, Let us first have a look at - Basic HTML concepts required for Selenium . You might be wondering why I should learn HTML?. The basic structure of an HTML document which includes Tags, Attributes and Elements.

There are many web browsers available in the market like Chrome, Firefox, Internet Explorer, Edge, Safari etc. To start with, first choose one browser from list of the browsers that you want to focus on executing your tests.

As Mozilla is changing the internals of Firefox browser to make more stable and secure, Selenium 3 will not fully work with Firefox Driver. (Will update once gecko driver has a stable release with all functionalities implemented and are working as expected)

If you want to write your tests on Firefox browser using selenium 3, you'll need to have the geckodriver, which is an executable similar to the chromedriver and edgedriver. But note that 'geckodriver' has to release stable version and they are still pending with few implementations like Actions class.

You can also use other browsers like Chrome and IE / Edge Browser, which ever you are comfortable with. Below are the syntax listed to run selenium;-

Selenium Webdriver 3.0

System.setProperty("webdriver.gecko.driver","path of geckodriver.exe");
WebDriver driver = new FirefoxDriver();

Selenium Webdriver 2.xx

WebDriver driver = new FirefoxDriver();

To execute your scripts on Chrome browser

System.setProperty("webdriver.chrome.driver", "path of chromedriver.exe");
WebDriver driver = new ChromeDriver();

Now here we go with selenium examples to start with Chrome, Mozilla, Internet Explorer and New Microsoft Edge Browser. If you are using eclipse as your IDE, then here is an example for you - Selenium webdriver using Eclipse

After opening a browser, the very first thing we would like to do is to navigate to a web page. Which we will do this by calling driver.get(string URL) method and make sure you always give fully qualified URL. You can also use driver.navigate.to(java.net.URL url) which is Overloaded version of driver.navigate.to(java.lang.String url).

You can check here for Navigation Methods in Webdriver with Examples And also check for the difference between Webdriver get() and Webdriver navigate()

Now its time to check out for different webdriver methods that are available with selenium WebDriver Methods

To perform any action on a web page, you will often need to define a locator to query the browser DOM for elements based on the scenario. It will be useful to know how CSS and/or XPaths are defined as we will be using them very frequently when automation any web application.

There are total 8 locators available to find the elements on web page and perform any action using them. You can find below listed topics/examples to better understand more about locators and how to use these locators to construct reliable paths.

Along with selenium scripts, we will also start using unit testing framework 'TestNG/JUnit' along with build automation tools like Maven/Ant. There are many other tools / libraries that will come across when working on a project which we will also cover like JExcel / Apache Poi to read and write excel sheets etc.

We have listed below topics/examples as Basic Selenium WebDriver Tutorials you should know and practice them using the demo website that we have built. It has almost all the functionalities that are used by most of the developers to build their web application.

Webdriver SELECT Methods to work with Dropdowns
Webdriver Select with Multiple Attribute
Working with Select examples
Working with Checkbox using Resuable Methods
How to work with multiple checkboxes

Different examples to work with Alerts, Windows, Frames and Authentication Window

  • Working with Frames in Selenium Webdriver
  • How to handle javascript alerts, confirmation and prompts?
  • Handle windows popups using Selenium Webdriver
  • Handling Authentication Window with WebDriver
  • Perform operations on new window
  • Upload and Download Examples:

  • Uploading a file with sendKeys method
  • Upload file using AutoIT
  • File upload using Robots
  • Download file using selenium webdriver
  • Advanced Selenium WebDriver Tutorials

  • Synchronization in Selenium Webdriver
  • Selenium WebDriver Waits Examples
  • Mouse Hover Actions in Selenium Webdriver
  • Set browser width and height in Selenium Webdriver
  • Resizing a web element using movebyoffset
  • Handling SSL certificates in Firefox browser
  • Handling SSL Certificates in Chrome and IE browser
  • Scrolling web page with Selenium Webdriver using java
  • Testing in multiple browsers using selenium and testng
  • Install AutoIt in Windows
  • Firefox Not Connected Exception in Selenium
  • Defining Firefox Profile preferences using Selenium Webdriver
  • StaleElementReferenceExceptions in Selenium Webdriver
  • Handling Cookies in Webdriver
  • How to addcookie with Selenium Webdriver
  • How to delete Cookies in Selenium Webdriver
  • Automation Test Frameworks
  • Taking Screenshot using Webdriver
  • Handling keyboard events and mouse hover events using Webdriver
  • Uploading a file with Selenium Webdriver
  • Read data from Properties file using Java Selenium
  • How to perform Drag and Drop
  • JavaScriptExecutor to Mouse Hover
  • Right Click Context Menu example
  • Working with AutoComplete Text box
  • Working with Date Picker Calendar
  • Validate Downloaded file after clicking on downloaded button/ link
  • How to verify entries in Exported CSV file
  • Element is not clickable at point SeleniumWebdriverException
  • Extract PDF text And Verify Text Present in PDF using WebDriver
  • How to Find Broken / Invalid Images on a Web Page
  • Find broken links on website using webdriver and HTTP Client
  • Verify tooltip text with selenium webdriver using java
  • Database testing with selenium example
  • Webdriver EventListener example
  • How to Configure Selenium Grid
  • Execute webdriver tests in Parallel using selenium Grid
  • Launch Edge browser using Microsoft Edge Driver
  • Selenium Framework Examples

  • Selenium Automation Framework Example
  • UI Map or Object Repository using Properties File
  • Test Data in automation framework
  • Test Automation Scripts Example Structure
  • Reporting Structure in Selenium Automation Framework
  • Test Configuration File / Executable File
  • Keyword Driven Framework Example
  • Introduction to Page Object Model Framework
  • Simple Page Object Model Framework Example
  • Database testing using Selenium Webdriver Framework Example
  • Page Factory Design Pattern
  • If You are unable to find the solution here,
    please feel free to send us your query to info@seleniumeasy.com