PacktLib: Selenium Testing Tools Cookbook

Selenium Testing Tools Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Locating Elements

Introduction

Using browser tools for inspecting elements and page structure

Locating an element using the findElement method

Locating elements using findElements method

Locating links

Locating elements by tag name

Locating elements using CSS selectors

Locating elements using XPath

Locating elements using text

Locating elements using advanced CSS selectors

Using jQuery selectors

Locating table rows and cells

Locating child elements in a table

Working with Selenium API

Introduction

Checking an element's text

Checking an element's attribute values

Checking an element's CSS values

Using Advanced User Interactions API for mouse and keyboard events

Performing double-click on an element

Performing drag-and-drop operations

Executing JavaScript code

Capturing screenshots with Selenium WebDriver

Capturing screenshots with RemoteWebDriver/Grid

Maximizing the browser window

Automating dropdowns and lists

Checking options in dropdowns and lists

Checking selected options in dropdowns and lists

Automating radio buttons and radio groups

Automating checkboxes

Controlling Windows processes

Reading a Windows registry value from Selenium WebDriver

Modifying a Windows registry value from Selenium WebDriver

Controlling the Test Flow

Introduction

Synchronizing a test with an implicit wait

Synchronizing a test with an explicit wait

Synchronizing a test with custom-expected conditions

Checking an element's presence

Checking an element's status

Identifying and handling a pop-up window by its name

Identifying and handling a pop-up window by its title

Identifying and handling a pop-up window by its content

Handling a simple JavaScript alert

Handling a confirm box alert

Handling a prompt box alert

Identifying and handling frames

Identifying and handling frames by their content

Working with IFRAME

Data-driven Testing

Introduction

Creating a data-driven test using JUnit

Creating a data-driven test using TestNG

Reading test data from a CSV file using JUnit

Reading test data from an Excel file using JUnit and Apache POI

Reading test data from a database using JUnit and JDBC

Creating a data-driven test in NUnit

Creating a data-driven test in MSTEST

Creating a data-driven test in Ruby using Roo

Creating a data-driven test in Python

Using the Page Object Model

Introduction

Using the PageFactory class for exposing elements from a page

Using the PageFactory class for exposing an operation on a page

Using the LoadableComponent class

Implementing nested Page Object instances

Implementing the Page Object model in .NET

Implementing the Page Object model in Python

Implementing the Page Object model in Ruby by using the page-object gem

Extending Selenium

Introduction

Creating an extension class for web tables

Creating an extension for the jQueryUI Tab widget

Implementing an extension for the WebElement object to set the element attribute values

Implementing an extension for the WebElement object to highlight elements

Creating an object map for Selenium tests

Capturing screenshots of elements in the Selenium WebDriver

Comparing images in Selenium

Testing on Mobile Browsers

Introduction

Setting up the iWebDriver App for the iPhone/iPad simulator

Setting up the iWebDriver App for an iPhone/iPad device

Running tests on iOS using the iWebDriver App and iPhone driver

Setting up the Android emulator for Selenium

Setting up the Android device for Selenium

Running tests using AndroidDriver

Client-side Performance Testing

Introduction

Measuring the response time using a timer

Measuring performance with the Navigation Timing API

Using the BrowserMob proxy for measuring performance

Using dynaTrace for measuring the performance

Using HttpWatch for measuring performance

Client-side performance testing with Watir-WebDriver-Performance in Ruby

Testing HTML5 Web Applications

Introduction

Automating the HTML5 video player

Automating interaction on the HTML5 canvas element

Web storage – testing local storage

Web storage – testing session storage

Cleaning local and session storage

Recording Videos of Tests

Introduction

Recording videos of tests using Monte Media Library in Java

Recording videos of tests using Microsoft Expression Encoder 4 SDK in .NET

Recording videos of tests using Castro in Python

Behavior-driven Development

Introduction

Using Cucumber-JVM and Selenium WebDriver in Java for BDD

Using SpecFlow.NET and Selenium WebDriver in .NET for BDD

Using JBehave and Selenium WebDriver in Java

Using Capybara, Cucumber, and Selenium WebDriver in Ruby

Index