Selenium Tutorials

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

How to Setup a Hub and Node for Selenium Grid

Selenium Grid allows us to execute our tests in multiple machines (physical / virtual) and multiple browsers with different versions, which dramatically speeds up test execution and helps in reducing total amount of time required for test execution.

For example, if we have a script that takes 100 minutes to execute sequentially , we could break that down to 10 short tests script run across 10 machines, and can complete them in 10 minutes without copying your test code to the other machine.

Webdriver Event Listener example

Webdriver events are helpful to view the events triggered by webdriver. It also plays an important role in analyzing results and helps us in debugging issues if we encounter any.

Selenium webdriver has ability to track different events such as 'beforeNavigateTo' , 'afterNavigateTo' , 'beforeClickOn' , 'afterClickOn', 'onException' and so on. When ever we develop test scripts we can write our own implementation for handling events during the execution.

How to do Database testing using Selenium Webdriver Framework Example

In previous tutorial, we have discussed about database testing and JDBC Java API which is primarily used to connect and interact with Database. Check out the simple example of Database testing with selenium.

In this tutorial, we will discuss how to perform database testing in different environments and pass the parameters to different methods in a simple way.

Database testing using Java, Selenium, TestNG example

As we know every application has to maintain a database like My SQL, Oracle or any other databases to store all its data. And where as Selenium Webdriver is used for testing web applications and we perform many operations like submitting information and some times retrieving information and validate them.

In selenium scripts, when there is a need of getting the Data from the database we may have to use APIs which helps to interact with database like JDBC.

Handling Untrusted SSL certificates in Firefox browser

Before jumping on to the example, first let us see What is SSL Certificate and When do we get UNTRUSTED CONNECTION Alert / Error.

Firstly, WHAT IS SSL CERTIFICATE ?

SSL is used to keep sensitive information which is sent across the Internet encrypted so that only the intended recipient understand it. This is important because, the information that we send on the internet is passed from one system to other system to the destination server.

How to verify tooltip text with selenium webdriver using java

When user mouse hovers an any item (Button/link/field etc), without clicking it, and a tool tip may appear with information about the item being hovered. And Some times it may require us to check for the tooltip text.

There are different ways in showing tool tip to the user. We will look into two such different examples, one is with simple HTML and other example with Jquery ToolTip.

Example#1:

Let us take selenium official website to verify the tooltip in the first case.

Find out broken links on website using selenium webdriver and HTTP Client

Earlier we have seen working with finding broken images, now here we will see finding invalid URLs. Here a valid URL will always have a status with 200. We have different HTTP status codes which are used for different purposes. You can check Wiki page for more information on HTTP Status Codes

Here 2xx class of status codes indicates that the action request by client was received and processed successfully without any issues.

Find Broken / Invalid Images on a Page

There are cases where we have seen image loading is failed due to many reasons, the most see is "Image not loading - Failed to load the given URL” because of image file is not located in the same location as that is specified or may be image file is corrupted. And it will be very difficult to identify invalid images when there are many in the applications.

Handling Authentication Window with WebDriver (In Firefox, Chrome and IE)

When you are working in a test environment, Stage or Pre Production, there are cases where you may need to work with applications which are secured with Authentication (Basic Auth).

When ever you enter the URL, it will prompt you to enter the User name and the password and It will not allow to perform any further operations until you provide username and password. And this Authentication pop-up is not a JavaScript pop-up, it is a Browser dialog window which selenium cannot handle simply using sendKeys method which we do for normal JavaScript pop-ups..