Selenium Tutorials

If you are a beginner, please Proceed here to start from the beginning.

Right Click Context Menu example

We will show how to work with context menu by taking a simple example. In the below example, we will first Right click on the element and the select the required option from the list of values. In the example we have also switched to an alert to verify if we have successfully clicked on the required link by using TestNG asserts

Simple Page Object Model example

In this example we will see a very simple Page Object Model example. To explain we have taken Google application and created BasePage, Sign In page and Create Account page.

To know what is page object model framework, Please refer Page Object Model Introduction
Steps to Create a Simple Page Object Model. The structure of the sample project should look like in the screen shot below

Drag and Drop using Webdriver Action Class

We have taken example program to perform drag and drop. In the below example, as the DragAndDrop divs are in a Frame, First we need to switch to the frame before performing drag and drop. And then we also need to check for the availability of SourceElement and DestinationElements.

Syntax for drag and drop
Actions action = new Actions(driver);
action.dragAndDrop(Sourcelocator, Destinationlocator).build().perform();

We can also make it as below:
(new Actions(driver)).dragAndDrop(element, target).perform();

Working with Multiple Checkboxes with Safecheck

We have seen working with checkboxes with different examples to select and de-select the checkboxes using selenium webdriver Select class Now in this tutorial we will working with multiple checkboxes.

There are cases were we need to select multiple checkboxes or de-select multiple checkboxes. Below is the sample code to work with multiple checkboxes.

Mouse hover using javaScript Executor

In order to perform a 'mouse hover' action, we need to take the help of Selenium Actions class. Which we have seen earlier Mouse Hover with Actions class

Now in this tutorial, we will see how to perform mouse hover using JavaScript Executor We will look into the below example and understand how it is working.

Introduction to Page Object Model Framework

Page Object Model Framework has now a days become very popular test automation framework in the industry and many companies are using it because of its easy test maintenance and reduces the duplication of code.

The main advantage of Page Object Model is that if the UI changes for any page, it don’t require us to change any tests, we just need to change only the code within the page objects (Only at one place). Many other tools which are using selenium, are following the page object model.

Perform operations on new window

There are cases where we need to open new window and perform operations or there may be cases where after clicking on any button / link, it opens new window and need to perform operations on the new window.

Let us look into such example:

Test case: We need to open '' and click on 'Help Center' link at the bottom which will open new window.
1. Verify the title of the new window
2. Verify text 'Welcome' on the page.
3. Search for a Question with text "Frequently Asked Questions" and verify the result.