Selecting Value From Dropdown Or Listbox

Selecting Value From Dropdown Or Listbox

Capturing Entire Page Screenshot

Most of the time we think to Capture Screenshot in WebDriver when some kind of error or exception surfaces while practicing testing, to resolve the same WebDriver has provided us one interface TakesScreenshot for capturing the screenshot of web application and This interface provides one method names as getScreenshotAs() to capture screenshot in instance of driver. This getScreenshotAs() method takes argument of type OutputType.File or OutputType.BASE64 or Output.BYTES.

We have taken the screenshot with the help of getScreenshotsAs() method and and now its time to copy this file somewhere in our file system or in our desktop. So for this purpose we further use copyFile() method of the FileUtils class.

Compare two Screenshot

Take Multiple Screenshot

Mouse Hover Event

In order to perform a 'mouse hover' action, we need to chain all of the actions that we want to achieve in one go. So move to the element that which has sub elements and click on the child item. It should the same way what we do normally to click on a sub menu item.

The mouse hover can be implemented using Action Class in Selenium

Handling Multiple Windows

Selenium WebDriver assigns an alphanumeric id to each window as soon as the WebDriver object is instantiated. This unique alphanumeric id is called window handle. Selenium uses this unique id to switch control among several windows.This window handle can be captured using getWindowHandle() method

String handle= driver.getWindowHandle(); //Return a string of alphanumeric window handle.

Handling Alert, Confirmation and Prompt popup

WebDriver offers the users with a very efficient way to handle these pop ups using Alert interface

Alert Popup Generally alert message popup display on page of software web application with alert text and Ok button

Confirmation Popup Confirmation popup displays on page of software web application with confirmation text, Ok and Cancel button

Prompt Popup Prompts will have prompt text, Input text box, Ok and Cancel buttons.

Verify Element Is Enabled Or Not

Handle Unexpected Alert Of Software Web Application

Highlighting element Of Software Web Application

Reading Font Properties Using .getCssValue()

Last updated