OOPS in Java Selenium

oops in java selenium

In OOPS selenium tutorials, You will learn What is Object Orianted proramming and Core concepts of the OOPS Like : Ineritance, PolyMorphism, Abstraction, Encapsulation and classes , Object, Constructors.

Selenium library uses all the OOPS concepts in it, we will explore few places where seleniu uses the OOPs concepts.


Basic selenium

basics in java selenium

In basic selenium tutorials, You will learn Installation of the eclipse and integrating the eclipse with selenium.

In automation testing opening a browser and closing a browser is important, we have designed basic selenium section to teach you about how to open different browsers with step by step details with code examples and how to open a webpage.

This basic selenium tutorial module will teach you all the operations related with browser and Webpage like extracting the webpage title and url. Also you will learn how to handle the browser size like maximizing and resizing the browser operations

We also have examples for how to retrieve the page source code and manipulate it.


HeadLess Browser Testing in Selenium

In Headess browser Selenium tutorial, You will learn how to make chrome and firefox browser to lose their UI, Also we will lean about the performance difference between headless chome, Headless firefox, Htmlunit browser.

A headless browser is a browser simulation program that does not have a user interface (UI less).

Headless browser programs operate like any other browser, but do not display any UI. Selenium executes its' tests in the background.

We can automate the headless browser in selenium, only automation can be performed on headless browser


WindowsUtils & Zip Class

In WindowsUtils & Zip Class Selenium Tutorial, you will learn how to handle the command prompt and the Zip files in the local system.

WindowsUtils class provides methods to handle the process on the command prompt, with the methods present in the WindowsUtils class we can get path details and kill process.

Zip class present in selenium helps user to perform zipping and unzipping operations, these kind of operation will be helpful, when you want to download a files and verify its contents.


Browser Options Class

In Browser Options Class Selenium Tutorial, you will learn how to set user option to the browser, it could be any browser like Chrome/Firefox/IE, etc.. .

ChromeOptions class extends MutableCapabilities Class and MutableCapabilities extends Object Class, ChromeOptions also implements Serializable, Capabilities.

We can use ChromeOptions class to manage options specific to ChromeDriver, Similar to ChromeOptions, Firefox also provides FirefoxOptions class where you can set all the options specific to the execution of the session.


String in selenium

strings in selenium

String are java object but whenever you try to fetch any value from the website, most of the time it will be String only.

In this String selenium tutorials you will learn what is string and it's characteristics as well as why string is immutable.

This Selenium Tutorial also covers what are the ways to create the string using Java like String class, StringBuilder, StringBuffer.

StringBuffer and StringBuilder creates mutable string in java.


Inspect webage

inspect in selenium

Inspect webpage Selenium Tutorial discusses about how to inspect an webpage and a webelement on the webpage to get tto know the properties/attributes of the element, based on out inspection we can from the locators or we can conclude which locators to use.

Till firefox 57 we were using the firebug and firepath but as the firefox changed its extention sdk, so with current firefox we cannot use firepath and firebug.

To replace firebug we have given detailed tutorial about Try xpath. Try xpath is replacement of Firebug.

Try Xpath doesnot support the chrome, to inspect elements in chrome we should use in-built developer console.

We can use selenium Looking-glass vbs script to find the element in the webpage, looking-glass helps us to find the element in all the major browsers.



xpath in java selenium

In Xpath selenium Tutorial, you will learn all the methods to create an Xpath to locate the element uniquely. We have to find the our webelement uniquely, so that we can perform operation only on that web element.

Xpath is nothing but the combination of attributes present in the HTML element. Xpath can help us to find the element based on the attribute, tagname, text present in the element.

Sometimes we may be using advanced xpath like based on one element we will find another element called as dependent and independent xpath


CSS Selector

In CSS selector Selenium Tutorial, We will learn how to create our Own CSS selector rather than depending on tools, CSS selector mainly used by developers to decorate the elements present in the webpage, sometime css selector also finds more than one matches.

Selenium script developers also can use CSS to find the element and to perform some operations. CSS is formed predominantly using tagname, class, and id.

CSS cannot find the elements based on the text present in the html element, But compared with xpath, CSS is faster in selenium webdriver.


WebElement in Selenium

In WebElement Selenium Tutorial, We will learn What is ebelement and its importance. Webelement is nothing but the any element present in the webpage, we can find the webelement using Xpath, CSS, id, class, name, link text, and partial link text.

We can find the first matching element using Find Element method and we can use Find elements method to get all the matching values present in the webpage

Find elements returns a List of Webelement, so we can perform all the operation on the list like java

We can retrieve attributes from an Webelement to perform or to validate some operations



waits in selenium

In Waits Selenium Tutorial, we will be learning how to match the speed of the selenium tool with the speed of the application. Selenium runs too faster than our application.

Sleep() method pauses the execution of the current thread and the selenium pauses the execution of the test cases for the specified time but I would not suggest using the sleep() method in your scripts

Implicitly wait is dynamic wait but is only applicable to find element and find elements, It wait for the specified time if selenium is able to find the element within the given tie then selenium stops waiting and continues with execution

Fluent wait is the best wait present in the selenium, we can mold the Fluent wait based on our need, based on Fluent wait only the explicit wait is formed

WebdriverWait / Explicit wait is applicable only for a specified condition, and if the condition is passed within the given tie then selenium continues with execution but if condition is not met then selenium waits till the specified time and then throws exception if the condition is not after specified time

Page Load Timeout waits for the specified time to load the page if the page is not loaded in given time then selenium throws exception.


WebElement Operations in selenium

In WebElement Operations in selenium tutorial, we will be learning the operation performed on any webelement.

We can perform operations like Clicking the element, setting value to the editable elements and submitting forms or retrieving the attributes and css values.

We can check the Web element state using isSelected(), isDisplayed(), isEnabled() methods. This tutorial also teaches how to get the size of the elements.

We will how to emulate the keyboard keys in selenium using sendkeys method


Select class

In Select class Selenium Tutorial, you will learn different ways to handle the dropdown, Operations like selecting a option, verifying all the options.

We have two types of dropdown Single values dropdown where you can select only one dropdown value and Multi-value dropdown, In multi values dropdown you can select more than one option.

Sometimes developers can form the dropdown using non-standard html tags, so we have a section to teach you how to handle the custom dropdowns

We have provided a practice page to play with dropdown, so you can learn and practice.


Action class

strings in selenium

In Action Class selenium Tutorial, You can learn how to handle the mouse operations. Action class selenium lets us to mimic the mouse in program.

We can perform operations like moving a mouse and dragging a element to the target place, or Double clicking the mouse

Mouse class also helps us to create multiple actions in a row, like clicking and dragging in same time.


Javascript executor

In Javascript Executor selenium Tutorial, teaches you how to use the javascript effective on the browser. Basically Javascript Executor helps us to perform some operation which are not able to done by selenium webdriver.

We can perform operations like clicking a element, setting a value to element, navigating to a page or scrolling a page till a element is visible.

We use Class called JavascriptExecutor to create the javascript actions.


Robot class

robot class in selenium

Action class mimics the mouse but robot class actually create the mouse events which are real. Using Robot class in selenium we can also capture full screen and specified area screenshots.

Action class is mostly used to handle the window based popups, which we cannot handle by selenium, Also we will learn about drawbacks of robot class


Handle Pop Ups

Handle Pop Ups selenium Tutorial deals with handling the pop that occur during the execution. Pop ups could could be javascript pop ups, Hidden division popups or Window based pop ups.

Most of the time we try to avoid the automation of windows based popups.

JavaScript pop ups are nothing but the alert, confirmation box, promt. We can handle the Javascript pop ups using Alert interface in selenium webdriver.

Hidden division pop ups are modal dialog boxes, which appear on webpage, we can handle the modal dialog boxes using normal selenium methods.


iFrames / Frames

frames in selenium

In iFrames / Frames selenium Tutorial, you can learn how to switch between the iFrames and page. iframes are used to show a same or different website on the current page, iframes are something like Television.

Now a days using iFrames in a webpage is bad practice, also Frames are not supported by HTML5.

Please note the Frame and Iframes are different.

We can handle frames/iframes present in the webpage using driver.switchTo() command in selenium webdriver. Frame/iFrame is nothing but another webelement in html page, which displays another part of webpage.


Windows/ Tabs Handling

windows in selenium

In Windows/ tab handling selenium tutorial, you will learn how to handle multiple windows and tabs with selenium.

You will learn how to handle windows when only two windows are present and when more than when two windows present.


Custom Locators

In Custom Locators selenium tutorial, we will learn how to create our own Locators

Sometimes it would be beneficial when we have our own locators instead of using default locators. When we want to train any person in Xpath or CSS it takes time to avoid that we can use Custom Locators.

There are more than 19 Locators present in selenium but most of the testers know only 8 Locators in selenium.


Custom WebElements

In Custom WebElements Selenium Tutorial, You can learn about how create new classes for handling webelements like webtable and custom dropdowns.

We can create Webtable class methods to get number of rows present in webtable, number of columns present in the webtable, also we can get the data from the specific cell and we can retrieve all the data from the Webtable.


Screenshots in Selenium

screenshots in selenium

In Screenshot selenium tutorial, you can learn about taking screenshot of a webpage and element level screenshots.

We can take screenshot of an webpage in selenium webdriver using getScreenshotAs() method, Webdriver interface doesnot provide method to take screenshot.

There is an interface called TakesScreenshot which provides getScreenshotAs method and which selenium users to take screenshot.

We can store the captured screenshot in different formats, all the formats are present in OutputType interface.



cookies in selenium

In Cookies Selenium tutorial, You will learn about how to set the cookies and get the cookies from the browser.

A cookie is small piece of information stored on your computer by a website you visit. Every time the user loads the website, the browser sends the cookie back to the server to notify the website of the user’s previous activity.

Options Interface ( inner interface ) present in the Webdriver interface provides the methods to handle the cookies, methods like crating a cookie, deleting, retrieving a cookie in Selenium Webdriver.



exception in selenium

In Exception selenium Tutorial, you will learn about what are the exception present in java and selenium and their reason, and also you will learn how to handle exception.

An Exception is an unplanned surprise that occurs during execution of program, the exception has power to stop the program execution.

Without a doubt exception stops the execution, but we are more powerful than exception so we can handle the exception without stopping the execution of the program.

We can handle the exception using try..catch..finally block, In layman terms, try block is nothing but a room in hospital which is little sensitive and we are having patient inside the particular room, when something unexpected happens in that room the hospital will be ready to handle the situation.

There are more than 40 Exceptions are present in the selenium webdriver.


Listeners in selenium

In Listeners selenium tutorial, You will learn about what are the listeners and hw to effectively use them on webdriver using Event firing webdriver

What is Event Listener?
An event listeners are set of functions in a selenium that waits for an event to occur; that event may be a user clicking or finding, changing value, or an Exception. The listeners are programmed to react to an input or signal.

EventFiringWebDriver is a wrapper on the webdriver, it provides all the methods which webdriver provides.

EventFiringWebDriver provide two more methods to register and unregister the Listeners implementing class


Apache POI

apache poi in selenium

In Apache POI selenium tutorial, you will learn how to read and write the excel sheet in the selenium webdriver using apache poi jar files.

Apache POI helps Java/Java related technologies to read and write Excel files on different platforms, Using apache poi we can do read and write operation of both xls and xlsx file formats. Apache poi is open source tool developed by apache.

Apache POI will be helpful to modify large content of data. Below are the step by step process to download Apache poi jar files.


Properties File

properties file in selenium

In Properties selenium tutorial, you will learn how to read and write the properties file in the selenium webdriver

Properties files stores simple parameters as key-value pairs, outside of compiled code. Key and Values are separated using '=' sign. Most of the time property file used to store url, username, password, environment etc..

Sometimes properties could be in different format like '.txt' or other, file could have any extension still we can use the same methods what we used in .properties file.


Auto IT

autoit in selenium

In Auto IT selenium tutorial, we will discuss about integrating the Auto IT with selenium webdriver to handle the operating system based pop-ups

Auto IT is basically used to simulate the keystrokes and mouse action and also we can create GUI but our site limit till mouse actions and keystrokes

AutoIt has built In feature to compile script and generate .exe executable file. You not need any extra add-on to do all these things.


Selenium Grid

grid in selenium

In Selenium Grid tutorial, you will learn about how to execute your automation scripts in the remote machines using selenium Grid

Selenium Grid is part of the Selenium project. It lets you distribute test execution across several machines.

You can connect to remote machines with help of Selenium Remote class by specifying the browser, browser version, and operating system you want.



In TestNG selenium tutorial, You will learn about TestNG unit testing framework and how to integrate the TestNg with selenium webdriver

TestNG is a unit test framework designed for testing needs, TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc.

We can sequence the execution of the testcase, we can create report for the execution. Using TestNG xmls we can also re-run the failed testcases.


Assert and SoftAssert

In Assert and SoftAssert selenium tutorial, we will discuss about what is assert and SoftAssert in TestNg and how to use Asserts along with selenium webdriver

Assertions in selenium webdriver are nothing but the verifications or checkpoints during the execution of the program.

Assert compares two items and results in pass or fail. But incase if the assert is failed then the code after the assert statement will not be executed and because of this only we are calling it as Hard Assert.

SoftAssert in TestNG is nothing but brother of Assert , the SoftAssert not only asserts a given conditions, but also gives a chance to user to continue the execution after Assertion failure.



In Log4j selenium tutorial, you will learn about logging in the framework in java, We use Log4J for logging purpose

Log4j is framework which helps the java user to record the messages (logs) during the execution time. Logs are nothing but the detailed execution steps

Logger captures the log messages generated by the framework, and it passes the logs to appends. Logger decides where to send the information like whether to file or to console. Loggers also decide what priority level to be captured.

Appenders writes the log messages decided by the logger into file or to database. Appenders delegates the message to the formatter. There different kind of appenders

The Layout component defines the format in which the log statements are written to the log destination by appender, like html or .log so on. There are diffrent kind of layout are present


Database Testing

In database testing selenium tutorial, we will learn how to connect to different databases and how to manipulate data in the databases.

JDBC (Java Database Connectivity) is an java api (like Actions, Collections ...), basically JDBC api is used to connect the databases with application using Java language.

JDBC connects almost all the databases present in current market like MYSQL, Oracle RDBMS, PostgreSQL, SQLite and few more databases.



In Frameworks selenium Tutorial, we would be learning how to create the frameworks and how to add new features to the framework.

Page Object Model is an object design pattern implementations of Page factory in Selenium, where web pages are represented as java classes, and the various elements on the page are defined as method on the PO classes.

All reusable methods are stored in libraries



In Maven selenium Tutorial, we will be discussing how to integrate maven with selenium and benefits of maven, also about maven repositories

Maven is dependency management tool i.e to execute the frameworks, we need the jar files. Maven helps user to keep the upto date jar file on the framework.

During runtime maven will check the version of the jar files present in the local system and compares with pom.xml file. If the latest version is available online then it downloads them automatically and replaces the local version and then executes the framework.


Code Review

In code review selenium tutorial, we would be learning what are the common mistakes we make in code while writing the selenium tests, also we will learn about best practices

Code review is examination (often known as peer review) of computer source code to check whether the written code follows the standards.

There are many tools which can help you control the code quality including SonarLint, FindBugs, SonarQube etc.

All of them are usually used to analyze the quality and build some useful reports. Very often those reports are published by continuous integration servers, like Jenkins.


Interview section

interview in selenium

In selenium Interview section, we have lots of interview question to solve from the recent times.