Selenium 1.0 Testing Tools: Beginner’s Guide

Test your web applications with multiple browsers using the Selenium Framework to ensure the quality of web applications

Selenium 1.0 Testing Tools: Beginner’s Guide

Beginner's Guide
David Burns

Test your web applications with multiple browsers using the Selenium Framework to ensure the quality of web applications
$23.99
$39.99
RRP $23.99
RRP $39.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Code Files
+ Collection

Book Details

ISBN 139781849510264
Paperback232 pages

About This Book

  • Save your valuable time by using Selenium to record, tweak and replay your test scripts
  • Get rid of any bugs deteriorating the quality of your web applications
  • Take your web applications one step closer to perfection using Selenium tests
  • Packed with detailed working examples that illustrate the techniques and tools for debugging

Who This Book Is For

If you are a Software quality assurance professional, software project manager, or software developer interested in developing automated testing in web based applications, then this book is definitely for you.

Table of Contents

Chapter 1: 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
Chapter 2: 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
Chapter 3: 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
Chapter 4: 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
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: 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
Chapter 9: 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
Chapter 10: 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
Chapter 11: 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

What You Will Learn

  • Use Selenium IDE to record, edit, and debug tests
  • Create tests to access JavaScript
  • Set Up the all important Selenium Remote Control successfully
  • Develop automated tests using the Selenium Remote Control
  • Get to grips with Selenium Remote Control Best practises
  • Set up the Selenium Grid to extend your Selenium RC
  • Create tests for Selenium Grid that can be distributed across multiple servers, saving you time by running tests in parallel
  • Create tests for Selenium 2
  • Create locators for elements on the web page
  • A wide range of miscellaneous tips, tricks and tasks to help get your web applications one step closer to perfection

In Detail

Selenium is a suite of tools to automate web application testing across many platforms. A strong understanding of using Selenium will get you developing tests to ensure the quality of your applications.

This book helps you understand and use Selenium to create tests and make sure that what your user expects to do can be done. It will guide you to successfully implement Selenium tests to ensure the quality of your applications.

The Selenium Testing Tools Beginner’s guide shows developers and testers how to create automated tests using a browser. You’ll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as css, xpath, DOM to find elements on the page.
Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.

Authors

Table of Contents

Chapter 1: 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
Chapter 2: 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
Chapter 3: 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
Chapter 4: 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
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: 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
Chapter 9: 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
Chapter 10: 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
Chapter 11: 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

Book Details

ISBN 139781849510264
Paperback232 pages
Read More