Selenium Essentials

Book description

Get to grips with automated web testing with the amazing power of Selenium WebDriver

In Detail

This book will help you seamlessly migrate from Selenium RC to Selenium WebDriver. You will be able to quickly develop automated tests with little effort. Based on popularity, support, and usage, the scripts throughout the book are in Java.

We will start off by familiarizing you with the Selenium IDE, teaching you its functions, and using it to automate and debug a complex website. Next, we will harness the power of Selenium WebDriver to perform cross-browser automation tests. We will then go to the next level and run automation tests on the cloud. After this, we will cover a wide range of functions provided by the Selenium WebDriver API that can be used for effective web automation tests. Finally, you will learn how to perform Data-Driven and Behavior-Driven tests.

What You Will Learn

  • Handle the Selenium IDE and Builder features efficiently
  • Integrate JavaScript with the Selenium IDE
  • Practice cross-browser testing in your favorite browser
  • Run automated Selenium WebDriver tests on different cloud servers
  • Go through all the Selenium WebDriver functions
  • Discover how to handle the features not supported by Selenium WebDriver
  • Observe various testing techniques using available frameworks
  • Develop your own Selenium framework for well-organized web application testing

Table of contents

  1. Selenium Essentials
    1. Table of Contents
    2. Selenium Essentials
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. The Selenium IDE
      1. WebDriver playback
        1. Prerequisites for the WebDriver playback feature
      2. Locator prioritization
      3. Avoiding Selenium export
      4. The Selenium IDE clipboard
      5. Data Driven tests
        1. User-defined JavaScript methods
      6. Selenium IDE JavaScript functions
        1. Simple JavaScript execution
        2. Mouse scroll
        3. Parameterization using arrays
      7. Selenium Builder
        1. Recording and playback
        2. Data Driven tests
          1. Testing using a JSON file
          2. Testing using an XML file
        3. Selenium Builder on the cloud
      8. Summary
    9. 2. Selenium WebDriver Cross-browser Tests
      1. Selenium WebDriver compatibility tests
        1. TestNG
      2. Selenium cross-browser tests on the cloud
        1. SauceLabs
        2. BrowserStack
        3. TestingBot
      3. Selenium headless browser testing
        1. PhantomJS
        2. HTMLUnitDriver
      4. Switching user agents
        1. Firefox user agent
        2. Chrome user agent
      5. Tests on specific Firefox versions
        1. Tests from the custom Firefox profile
      6. Tests from the custom Chrome profile
      7. Summary
    10. 3. Selenium WebDriver Functions
      1. Basic WebDriver functions
      2. Locating WebElements
      3. WebElement functions
      4. Navigation
      5. Cookies
      6. Window functions
      7. Select functions
      8. Handling alerts and pop-ups
      9. Mouse and keyboard actions
      10. Summary
    11. 4. Selenium WebDriver Best Practices
      1. Handling Ajax websites
        1. The isElementPresent method
      2. Waits
        1. Explicit wait
          1. The FluentWait method
          2. Sleeper
        2. Timeouts
      3. The PageObject pattern
        1. The PageFactory class
        2. The @FindBy annotation
        3. The @FindBys annotation
      4. The EventFiringWebDriver class
        1. Event-firing WebDriver example
      5. Handling iframes
        1. Handling native OS and browser pop-ups using Java Robot
          1. Downloading browser pop-ups
          2. Screen capture
        2. Firefox profile to download files
      6. The JavascriptExecutor class
        1. Page scroll
        2. Highlighting elements
        3. Opening a new browser window
        4. JavaScript error collector
      7. Summary
    12. 5. Selenium WebDriver Frameworks
      1. Behaviour-Driven Development
        1. Cucumber BDD framework
          1. Cucumber JVM
          2. JBehave BDD framework
      2. JXL API Data-Driven framework
        1. Reading and writing in an Excel sheet
        2. Simple Data-Driven approach
        3. Data-Driven testing using reusable library
        4. Data-Driven testing using TestNG with the @dataProvider annotation
      3. Apache POI Data-Driven framework
        1. HSSF usermodel – Binary workbook
        2. XSSF usermodel – SpreadsheetML workbook (.xlsx)
        3. SS usermodel – Binary and SpreadsheetML workbooks
          1. Text file Data-Driven framework
        4. Data-Driven testing using TestNG with the @dataProvider annotation – text file
      4. Properties file Data-Driven framework
        1. Data-Driven testing using TestNG with @dataProvider annotation – properties file
        2. CSV file Data-Driven framework
      5. Keyword-Driven framework
      6. Hybrid-Driven framework
      7. Summary
    13. Index

Product information

  • Title: Selenium Essentials
  • Author(s): Prashanth Sams
  • Release date: March 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781784394332