Selenium Tutorials

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

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..

Extract PDF text And Verify Text Present in PDF using WebDriver

Most of the applications has 'Print PDF' functionality. How to achieve this in Automation. we first need to decide is this really required to automate, if your answer is Yes then proceed further to see how we can achieve this. In Earlier tutorial we have seen validating if the file downloaded or not after clicking on download button. In this tutorial we will now see to validate Print PDF functionality by using below two ways.

There are multiple ways of doing this.

Element is not clickable at point SeleniumWebdriverException

This issue comes only when working with chrome driver as the chrome browsers uses point location. When the element position is not fixed and we are trying to do some action on that particular element will result an error as 'selenium.common.exceptions.WebDriverException - Element is not clickable at point (xx, xx). Other element would receive the click'.

How to verify entries in Exported CSV file

In this article we will look into verify Export functionality. Export functionality is exporting a document/downloading a document which has number of records / data which need to be verified. Generally exported document will be in the form of csv file. We will now read csv file with the help of Java FileReader and LineNumberReader

Validate Downloaded file after clicking on downloaded button/ link

It is very important to verify if the file is downloaded successful or not. Most of the cases we just concentrate on clicking the downloaded button. But at the same time it is also very important to confirm that file is downloaded successfully without any errors or if some other file is getting downloaded.

In most of the cases we know which file is getting downloaded after clicking on download button / link. Now when we know the file name, we can verify using java for the 'File Exists' in a downloaded folder location which we specify.

Resizing a web element using movebyoffset

Normally when ever we want to change the size of an element we do with the help of mouse manually. Now we will see to resize / change the size of an element using webdriver actions class with moveByOffset which moves the mouse position from its current position by the given offset.

Below are the simple steps thats needs to be followed for the below example:-

Get Css values using Webdriver

When ever we are testing the applications, we may require css value of the element. Say now we need to check the scenario of a button color/state getting changed or not when we do mouse hover.

To check this, we can check the css values that are changing when we perform mouse hover on the element.

Now let us take an example of 'Google Search' button in google home page.

Get Attribute values using Webdriver

There are cases where you want to get the attributes values and then perform any action.

In the below, if you see, button tag which has multiple attributes 'name', 'id', 'class' and 'aria-label' and has values for each attribute. To get the attribute value using selenium webdriver, we can use 'element.getAttribute(attributeName)'.

If we try to get the attribute value that doesn't exists for the tag, it will return null value.