You are previewing Selenium 1.0 Testing Tools Beginner's Guide.
O'Reilly logo
Selenium 1.0 Testing Tools Beginner's Guide

Book Description

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

  • 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

  • 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.

    A beginner’s guide to writing Selenium tests using different aspects of the Framework to give you confidence in your web application

    Table of Contents

    1. Selenium 1.0 Testing Tools
      1. Selenium 1.0 Testing Tools Beginner's Guide
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Time for action - heading
          1. What just happened?
          2. Pop quiz heading
          3. Have a go hero heading
        6. Reader feedback
          1. Errata
          2. Piracy
          3. Questions
      6. 1. Getting Started with Selenium IDE
        1. Important preliminary points
        2. What is Selenium IDE
        3. Time for action - installing Selenium IDE
          1. What just happened?
        4. Selenium IDE
          1. Selenium IDE icons
        5. Important note
        6. Time for action - recording your first test with Selenium IDE
          1. What just happened?
          2. Pop quiz Selenium IDE
        7. Updating a test to assert items are on the page
        8. Time for action - updating a test to verify items on the page
          1. What just happened?
          2. Have a go hero using the IDE
          3. Pop quiz
          4. Comments
        9. Time for action - adding Selenium IDE comments
          1. What just happened?
        10. Multiple windows
        11. Time for action - working with multiple windows
          1. What just happened?
        12. Time for action - switching between multiple windows
          1. What just happened?
        13. Selenium tests against AJAX applications
        14. Time for action - working on pages with AJAX
          1. What just happened?
        15. Time for action - working with AJAX applications
          1. What just happened?
          2. Pop quiz Selenium IDE
          3. Storing information from the page in the test
        16. Time for action - storing elements from the page
          1. What just happened?
          2. Debugging tests
        17. Time for action - debugging tests
          1. What just happened?
          2. Test suites
        18. Time for action - creating test suites
          1. What just happened?
          2. Pop quiz
        19. Saving tests
        20. What you cannot record
          1. Have a go hero doing more with Selenium IDE
        21. Summary
      7. 2. Locators
        1. Important preliminary points
        2. Locating elements by ID
        3. Time for action - finding IDs of elements on the page with Firebug
          1. What just happened?
          2. Pop quiz using the Find button
        4. Time for action - finding elements by ID
          1. What just happened?
        5. Moving elements on the page
        6. Time for action - finding elements by name
          1. What just happened?
        7. Adding filters to the name
        8. Time for action - finding elements by link text
          1. What just happened?
        9. Time for action - finding elements by accessing the DOM through JavaScript
          1. What just happened?
          2. Pop quiz
        10. Time for action - finding elements by XPath
          1. What just happened?
          2. Using direct XPath in your test
          3. Using XPath to find the nth element of a type
          4. Using element attributes in XPath queries
          5. Doing a partial match on attribute content
          6. Finding an element by the text it contains
          7. Using XPath axis to find elements
          8. Pop quiz using XPath axis
          9. Have a go hero
        11. CSS selectors
        12. Time for action - finding elements by CSS
          1. What just happened?
          2. Using child nodes to find the element
          3. Using sibling nodes to find the element
          4. Using CSS class attributes in CSS selectors
          5. Using element IDs in CSS selectors
          6. Finding elements by their attributes
          7. Partial matches on attributes
          8. Finding the nth element with CSS
          9. Finding an element by its inner text
          10. Pop quiz using locators
          11. Have a go hero working against Google Maps
        13. Summary
      8. 3. Pattern Matching
        1. Verifying exact text
        2. Time for action - verifying text
          1. What just happened?
        3. Time for action - using exact: on links
          1. What just happened?
          2. Pop quiz using exact: in locators
          3. Have a go hero using exact: in locators
        4. Using globs in our tests
        5. Time for action - using globs in tests
          1. What just happened?
        6. Time for action - using * to find a basic pattern
          1. What just happened?
        7. Time for action - using ? in a glob pattern
          1. What just happened?
        8. Time for action - using character classes in globbing
          1. What just happened?
          2. Pop quiz using globbing
          3. Have a go hero using globbing
        9. Using regular expressions
        10. Time for action - using basic regular expressions to check the date
          1. What just happened?
        11. Time for action - using regular expression wildcards
          1. What just happened?
          2. Pop quiz using regular expressions
          3. Have a go hero using regular expressions
        12. Summary
      9. 4. Using JavaScript
        1. Using JavaScript as our test language
        2. Time for action - using JavaScript to enter text into a field
          1. What just happened?
        3. Time for action - using multiple statements in your JavaScript
          1. What just happened?
        4. Time for action - storing the result of JavaScript in a variable
          1. What just happened?
          2. Pop quiz using JavaScript
          3. Have a go hero doing more with JavaScript
        5. Using Selenium variables with JavaScript
        6. Time for action - using Selenium variables with JavaScript
          1. What just happened?
        7. Time for action - JavaScript within a verify or assert
          1. What just happened?
          2. Pop quiz using Selenium variables in JavaScript
          3. Have a go hero using Selenium variables in JavaScript
        8. Accessing the browser with JavaScript
        9. Time for action - accessing the page with browserbot
          1. What just happened?
        10. Time for action - verifying a JavaScript evaluation with browserbot
          1. What just happened?
        11. Time for action - using waitForCondition
          1. What just happened?
          2. Pop quiz accessing the browser with JavaScript
          3. Have a go hero accessing the browser with JavaScript
        12. Firing events
        13. Time for action - firing a mouseOver event
          1. What just happened?
        14. Time for action - firing an onBlur event in Selenium
          1. What just happened?
        15. Summary
      10. 5. User Extensions and Add-ons
        1. Important preliminary points
        2. User extensions
        3. Time for action - installing a user extension
          1. What just happened?
        4. Time for action - using Selenium variables in extensions
          1. What just happened?
        5. Time for action - using locators in extensions
          1. What just happened?
        6. Time for action - using browserbot from within an extension
          1. What just happened?
        7. Time for action - creating new commands to verify or assert
          1. What just happened?
          2. Pop quiz
          3. Have a go hero doing more with user extensions
        8. Add-ons
        9. Time for action - creating a basic add-on
          1. What just happened?
          2. Pop quiz
        10. Summary
      11. 6. First Steps with Selenium RC
        1. Important preliminary points
        2. What is Selenium Remote Control
        3. Setting up Selenium Remote Control
        4. Time for action - setting up Selenium Remote Control
          1. What just happened?
          2. Pop quiz setting up Selenium Remote Control
        5. Running Selenium IDE tests with Selenium Remote Control
        6. Time for action - running Selenium IDE tests with Selenium Remote Control
          1. What just happened?
          2. Running your Selenium IDE tests in Internet Explorer
        7. Time for action - running our tests in Internet Explorer
          1. What just happened?
          2. Running your Selenium IDE tests in Google Chrome
        8. Time for action - running Selenium IDE tests within Google Chrome
          1. What just happened?
          2. Running your Selenium IDE tests with the User Extensions
        9. Time for action - running Selenium IDE tests with User Extensions
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        10. Selenium Remote Control arguments
          1. -port
          2. -userExtensions
          3. -firefoxProfileTemplate
        11. Summary
      12. 7. Creating Selenium Remote Control Tests
        1. Important preliminary points
        2. Converting Selenium IDE tests to a programming language
        3. Time for action - converting Selenium IDE tests to a language
          1. What just happened?
          2. Pop quiz
          3. Have a go hero using different browsers
        4. Writing Selenium tests from scratch
        5. Time for action - creating a Selenium instance with JUnit 3
          1. What just happened?
        6. Time for action - creating a Selenium instance with SeleneseTestCase setUp()
          1. What just happened?
        7. Time for action - creating a Selenium instance with JUnit 4
          1. What just happened?
        8. Time for action - creating a Selenium instance with TestNG
          1. What just happened?
        9. Time for action - creating a test from scratch
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        10. Selenium Remote Control best practises
        11. Time for action - setting up the test
          1. What just happened?
        12. Time for action - moving Selenium steps into Private methods to make tests maintainable
          1. What just happened?
        13. Time for action - using the Page Object Pattern to design tests
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        14. Setting our tests up in a Continuous Integration server
        15. Time for action - creating an Ant file
          1. What just happened?
        16. Summary
      13. 8. Advanced Selenium Techniques
        1. Important preliminary points
          1. Cookie handling
        2. Time for action - getting a cookie off the page
          1. What just happened?
          2. Getting all cookies
        3. Time for action - getting all cookies on the page
          1. What just happened?
          2. Deleting cookies
        4. Time for action - deleting a cookie
          1. What just happened?
          2. Pop quiz working with cookies
          3. Have a go hero doing more with cookies
        5. Adding a new location strategy
        6. Time for action - adding a new location strategy
          1. What just happened?
        7. Capturing network traffic
        8. Time for action - capturing network traffic
          1. What just happened?
        9. Capturing screenshots
          1. captureScreenshot call
        10. Time for action - capturing screenshots
          1. What just happened?
        11. Time for action - capturing a screenshot to string
          1. What just happened?
          2. Capturing the entire page
        12. Time for action - capturing the entire page as a screenshot
          1. What just happened?
        13. Time for action - capture entire page as a screenshot changing background colour
          1. What just happened?
        14. Time for action - capturing the entire page screenshot to a string
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        15. Capturing video
        16. Time for action - setting up the environment to capture video
          1. What just happened?
        17. Time for action - recording a video in a test
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        18. Summary
      14. 9. Getting Started with Selenium Grid
        1. Important preliminary points
        2. Understanding Selenium Grid
        3. Checking that we have the necessary items for Selenium Grid
        4. Time for action - doing a sanity check on Selenium Grid
          1. What just happened?
        5. Selenium Grid Hub
        6. Time for action - launching the hub
          1. What just happened?
        7. Adding instances to the hub
        8. Time for action - adding a remote control with the defaults
          1. What just happened?
          2. Adding Selenium Remote Controls for different machines
        9. Time for action - adding Selenium Remote Controls for different machines
          1. What just happened?
          2. Adding Selenium Remote Control for different browsers
        10. Time for action - setting the Environment when starting Selenium Remote Control
          1. What just happened?
          2. Updating the Selenium Grid Configuration
        11. Time for action - adding new items to the Grid Configuration
          1. What just happened?
          2. Pop quiz doing the thing
        12. Running tests against the Grid
        13. Time for action - writing tests against the grid
          1. What just happened?
        14. Summary
      15. 10. Running Selenium Tests in Parallel
        1. Important preliminary points
        2. Setting up TestNG
        3. Time for action - starting to create the test suite
          1. What just happened?
          2. Parameters in the configuration file
        4. Time for action - creating a test node in the TestNG configuration
          1. What just happened?
          2. Getting our tests to use parameters
        5. Time for action - adding the parameters to our tests
          1. What just happened?
          2. Parallel testing
        6. Time for action - getting our tests running in parallel
          1. What just happened?
          2. Pop quiz running tests in parallel
          3. Have a go hero doing more with the thing
        7. Tips and tricks for running tests in parallel
          1. Independent tests
          2. Cleaning up tests
          3. Username and password
          4. Firefox profiles
        8. Summary
      16. 11. Getting Started with Selenium 2
        1. Important preliminary points
        2. Why Selenium and WebDriver are being merged
          1. So what if a new browser is released?
        3. How will the browser interaction change?
        4. Converting Selenium 1 tests to Selenium 2
        5. Time for action - converting tests to Selenium 2 using WebDriverBackedSelenium
          1. What just happened?
          2. Pop quiz
        6. Starting a Selenium 2 browser instance
        7. Time for action - instantiating new browsers and closing them
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        8. Accessing elements on the page and interacting with them
        9. Time for action - finding a link and clicking it
          1. What just happened?
          2. Finding elements with XPath
        10. Time for action - finding an element with XPath
          1. What just happened?
          2. Finding multiple elements
        11. Time for action - finding multiple elements on the page
          1. What just happened?
          2. Typing into input fields
        12. Time for action - typing into a text box
          1. What just happened?
          2. Real-life interaction
        13. Time for action - working with hidden elements throws errors
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        14. Working with JavaScript in Selenium 2
        15. Time for action - using JavaScript in Selenium 2
          1. What just happened?
          2. Returning something from your JavaScript to your test
        16. Time for action - returning from executing JavaScript
          1. What just happened?
          2. Pop quiz
          3. Have a go hero
        17. Summary