PacktLib: Selenium 1.0 Testing Tools: Beginner’s Guide

Selenium 1.0 Testing Tools Beginner's Guide

Credits

About the Author

About the Reviewers

Preface

Getting Started with Selenium IDE

Important preliminary points

What is Selenium IDE

Time for action – installing Selenium IDE

Selenium IDE

Important note

Time for action – recording your first test with Selenium IDE

Updating a test to assert items are on the page

Time for action – updating a test to verify items on the page

Time for action – adding Selenium IDE comments

Multiple windows

Time for action – working with multiple windows

Time for action – switching between multiple windows

Selenium tests against AJAX applications

Time for action – working on pages with AJAX

Time for action – working with AJAX applications

Time for action – storing elements from the page

Time for action – debugging tests

Time for action – creating test suites

Saving tests

What you cannot record

Summary

Locators

Important preliminary points

Locating elements by ID

Time for action – finding IDs of elements on the page with Firebug

Time for action – finding elements by ID

Moving elements on the page

Time for action – finding elements by name

Adding filters to the name

Time for action – finding elements by link text

Time for action – finding elements by accessing the DOM through JavaScript

Time for action – finding elements by XPath

CSS selectors

Time for action – finding elements by CSS

Summary

Pattern Matching

Verifying exact text

Time for action – verifying text

Time for action – using exact: on links

Using globs in our tests

Time for action – using globs in tests

Time for action – using * to find a basic pattern

Time for action – using ? in a glob pattern

Time for action – using character classes in globbing

Using regular expressions

Time for action – using basic regular expressions to check the date

Time for action – using regular expression wildcards

Summary

Using JavaScript

Using JavaScript as our test language

Time for action – using JavaScript to enter text into a field

Time for action – using multiple statements in your JavaScript

Time for action – storing the result of JavaScript in a variable

Using Selenium variables with JavaScript

Time for action – using Selenium variables with JavaScript

Time for action – JavaScript within a verify or assert

Accessing the browser with JavaScript

Time for action – accessing the page with browserbot

Time for action – verifying a JavaScript evaluation with browserbot

Time for action – using waitForCondition

Firing events

Time for action – firing a mouseOver event

Time for action – firing an onBlur event in Selenium

Summary

User Extensions and Add-ons

Important preliminary points

User extensions

Time for action – installing a user extension

Time for action – using Selenium variables in extensions

Time for action – using locators in extensions

Time for action – using browserbot from within an extension

Time for action – creating new commands to verify or assert

Add-ons

Time for action – creating a basic add-on

Summary

First Steps with Selenium RC

Important preliminary points

What is Selenium Remote Control

Setting up Selenium Remote Control

Time for action – setting up Selenium Remote Control

Running Selenium IDE tests with Selenium Remote Control

Time for action – running Selenium IDE tests with Selenium Remote Control

Time for action – running our tests in Internet Explorer

Time for action – running Selenium IDE tests within Google Chrome

Time for action – running Selenium IDE tests with User Extensions

Selenium Remote Control arguments

Summary

Creating Selenium Remote Control Tests

Important preliminary points

Converting Selenium IDE tests to a programming language

Time for action – converting Selenium IDE tests to a language

Writing Selenium tests from scratch

Time for action – creating a Selenium instance with JUnit 3

Time for action – creating a Selenium instance with SeleneseTestCase setUp()

Time for action – creating a Selenium instance with JUnit 4

Time for action – creating a Selenium instance with TestNG

Time for action – creating a test from scratch

Selenium Remote Control best practises

Time for action – setting up the test

Time for action – moving Selenium steps into Private methods to make tests maintainable

Time for action – using the Page Object Pattern to design tests

Setting our tests up in a Continuous Integration server

Time for action – creating an Ant file

Summary

Advanced Selenium Techniques

Important preliminary points

Time for action – getting a cookie off the page

Time for action – getting all cookies on the page

Time for action – deleting a cookie

Adding a new location strategy

Time for action – adding a new location strategy

Capturing network traffic

Time for action – capturing network traffic

Capturing screenshots

Time for action – capturing screenshots

Time for action – capturing a screenshot to string

Time for action – capturing the entire page as a screenshot

Time for action – capture entire page as a screenshot changing background colour

Time for action – capturing the entire page screenshot to a string

Capturing video

Time for action – setting up the environment to capture video

Time for action – recording a video in a test

Summary

Getting Started with Selenium Grid

Important preliminary points

Understanding Selenium Grid

Checking that we have the necessary items for Selenium Grid

Time for action – doing a sanity check on Selenium Grid

Selenium Grid Hub

Time for action – launching the hub

Adding instances to the hub

Time for action – adding a remote control with the defaults

Time for action – adding Selenium Remote Controls for different machines

Time for action – setting the Environment when starting Selenium Remote Control

Time for action – adding new items to the Grid Configuration

Running tests against the Grid

Time for action – writing tests against the grid

Summary

Running Selenium Tests in Parallel

Important preliminary points

Setting up TestNG

Time for action – starting to create the test suite

Time for action – creating a test node in the TestNG configuration

Time for action – adding the parameters to our tests

Time for action – getting our tests running in parallel

Tips and tricks for running tests in parallel

Summary

Getting Started with Selenium 2

Important preliminary points

Why Selenium and WebDriver are being merged

How will the browser interaction change?

Converting Selenium 1 tests to Selenium 2

Time for action – converting tests to Selenium 2 using WebDriverBackedSelenium

Starting a Selenium 2 browser instance

Time for action – instantiating new browsers and closing them

Accessing elements on the page and interacting with them

Time for action – finding a link and clicking it

Time for action – finding an element with XPath

Time for action – finding multiple elements on the page

Time for action – typing into a text box

Time for action – working with hidden elements throws errors

Working with JavaScript in Selenium 2

Time for action – using JavaScript in Selenium 2

Time for action – returning from executing JavaScript

Summary

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Pop Quiz Answers

Index