Table of Contents
Preface
Chapter 1: Getting Started with Selenium IDE
Chapter 2: Locators
Chapter 3: Pattern Matching
Chapter 4: Using JavaScript
Chapter 5: User Extensions and Add-ons
Chapter 6: First Steps with Selenium RC
Chapter 7: Creating Selenium Remote Control Tests
Chapter 8: Advanced Selenium Techniques
Chapter 9: Getting Started with Selenium Grid
Chapter 10: Running Selenium Tests in Parallel
Chapter 11: Getting Started with Selenium 2
Pop Quiz Answers
Index
- Chapter 1: Getting Started with Selenium IDE
- Important preliminary points
- What is Selenium IDE
- Time for action – installing Selenium IDE
- Selenium IDE
- Selenium IDE icons
- 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
- Comments
- 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
- Storing information from the page in the test
- Time for action – storing elements from the page
- Debugging tests
- Time for action – debugging tests
- Test suites
- 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
- Using direct XPath in your test
- Using XPath to find the nth element of a type
- Using element attributes in XPath queries
- Doing a partial match on attribute content
- Finding an element by the text it contains
- Using XPath axis to find elements
- CSS selectors
- Time for action – finding elements by CSS
- Using child nodes to find the element
- Using sibling nodes to find the element
- Using CSS class attributes in CSS selectors
- Using element IDs in CSS selectors
- Finding elements by their attributes
- Partial matches on attributes
- Finding the nth element with CSS
- Finding an element by its inner text
- 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
- Running your Selenium IDE tests in Internet Explorer
- Time for action – running our tests in Internet Explorer
- Running your Selenium IDE tests in Google Chrome
- Time for action – running Selenium IDE tests within Google Chrome
- Running your Selenium IDE tests with the User Extensions
- 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
- Cookie handling
- Time for action – getting a cookie off the page
- Getting all cookies
- Time for action – getting all cookies on the page
- Deleting cookies
- 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
- captureScreenshot call
- Time for action – capturing screenshots
- Time for action – capturing a screenshot to string
- Capturing the entire page
- 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
- Important preliminary points
- 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
- Adding Selenium Remote Controls for different machines
- Time for action – adding Selenium Remote Controls for different machines
- Adding Selenium Remote Control for different browsers
- Time for action – setting the Environment when starting Selenium Remote Control
- Updating the Selenium Grid Configuration
- 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
- Parameters in the configuration file
- Time for action – creating a test node in the TestNG configuration
- Getting our tests to use parameters
- Time for action – adding the parameters to our tests
- Parallel testing
- Time for action – getting our tests running in parallel
- Tips and tricks for running tests in parallel
- Independent tests
- Cleaning up tests
- Username and password
- Firefox profiles
- Summary
- Chapter 11: Getting Started with Selenium 2
- Important preliminary points
- Why Selenium and WebDriver are being merged
- So what if a new browser is released?
- 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
- Finding elements with XPath
- Time for action – finding an element with XPath
- Finding multiple elements
- Time for action – finding multiple elements on the page
- Typing into input fields
- Time for action – typing into a text box
- Real-life interaction
- Time for action – working with hidden elements throws errors
- Working with JavaScript in Selenium 2
- Time for action – using JavaScript in Selenium 2
- Returning something from your JavaScript to your test
- Time for action – returning from executing JavaScript
- Summary
- Pop Quiz Answers
- Chapter 1 – Getting Started with Selenium IDE
- Chapter 2 – Locators
- Chapter 3 – Pattern Matching
- Chapter 4 – Using JavaScript
- Chapter 5 – User Extensions and Add-ons
- Chapter 6 – First Steps with Selenium RC
- Chapter 7 – Creating Selenium Remote Control Tests
- Chapter 8 – Advanced Selenium Techniques
- Chapter 9 – Getting Started with Selenium Grid
- Chapter 10 – Running Selenium Tests in Parallel
- Chapter 11 – Getting started with Selenium 2


