Selenium WebDriver Practical Guide


Selenium WebDriver Practical Guide
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Covers basic to advanced concepts of WebDriver
  • Learn how to design a more effective automation framework
  • Explores all of the APIs within WebDriver
  • Acquire an in-depth understanding of each concept through practical code examples

Book Details

Language : English
Paperback : 264 pages [ 235mm x 191mm ]
Release Date : January 2014
ISBN : 1782168850
ISBN 13 : 9781782168850
Author(s) : Satya Avasarala
Topics and Technologies : All Books, Web Development, Open Source


Table of Contents

Preface
Chapter 1: Introducing WebDriver and WebElements
Chapter 2: Exploring Advanced Interactions of WebDriver
Chapter 3: Exploring the Features of WebDriver
Chapter 4: Different Available WebDrivers
Chapter 5: Understanding WebDriver Events
Chapter 6: Dealing with I/O
Chapter 7: Exploring RemoteWebDriver and WebDriverBackedSelenium
Chapter 8: Understanding Selenium Grid
Chapter 9: Understanding PageObject Pattern
Chapter 10: Testing iOS and Android Apps
Index
  • Chapter 1: Introducing WebDriver and WebElements
    • Understanding the history of Selenium
      • Selenium 1 or Selenium Remote Control or Selenium RC
      • Selenium 2 or Selenium WebDriver or WebDriver
      • Differences between Selenium 1 and Selenium 2
        • Handling the browser
        • Having better APIs
        • Testing mobile apps
        • Having developer support and advanced functionalities
    • Setting up a project in Eclipse
    • WebElements
      • Locating WebElements using WebDriver
        • The findElement() method
        • The findElements() method
        • Firebug
        • Using the By locating mechanism
      • Actions on WebElements
        • The getAttribute() method
        • The sendKeys() method
        • The clear() method
        • The submit() method
        • The getCssValue() method
        • The getLocation() method
        • The getSize() method
        • The getText() method
        • The getTagName() method
        • The isDisplayed() method
        • The isEnabled() method
        • The isSelected() method
    • Summary
  • Chapter 2: Exploring Advanced Interactions of WebDriver
    • Understanding actions, build, and perform
      • Learning mouse-based interactions
        • The moveByOffset action
        • The click at current location action
        • The click on a WebElement action
        • The clickAndHold at current location action
        • The clickAndHold a WebElement action
        • The release at current location action
        • The release on another WebElement action
        • The moveToElement action
        • The dragAndDropBy action
        • The dragAndDrop action
        • The doubleClick at current location action
        • The doubleClick on WebElement action
        • The contextClick on WebElement action
        • The contextClick at current location action
      • Learning keyboard-based interactions
        • The keyDown and keyUp actions
        • The sendKeys() method
    • Summary
  • Chapter 3: Exploring the Features of WebDriver
    • Setting the desired capabilities for a browser
    • Taking screenshots
    • Locating target windows and iFrames
      • Switching among windows
      • Switching among frames
      • Handling alerts
    • Exploring Navigate
    • Waiting for WebElements to load
      • Implicit wait time
      • Explicit wait time
    • Handling cookies
    • Summary
  • Chapter 4: Different Available WebDrivers
    • FirefoxDriver
      • Understanding the Firefox profile
        • Adding the extension to Firefox
        • Storing and retrieving a profile
      • Dealing with Firefox preferences
        • Setting preferences
        • Understanding frozen preferences
      • Firefox binary
        • Installing multiple versions of Firefox
    • InternetExplorerDriver
      • Installing InternetExplorerDriver
      • Writing your first test script for the IE browser
      • Building the InternetExplorer driver service
      • Understanding IEDriver capabilities
    • ChromeDriver
      • Installing ChromeDriver
      • Writing your first test script for the Chrome browser
      • Using ChromeOptions
    • SafariDriver
      • Writing your first test script for the Safari browser
    • OperaDriver
      • Installing OperaDriver
      • Writing your first test script for the Opera browser
    • Summary
  • Chapter 5: Understanding WebDriver Events
    • Introducing EventFiringWebDriver and EventListener classes
    • Creating an instance of EventListener
      • Implementing WebDriverEventListener
      • Extending AbstractWebDriverEventListener
      • Creating a WebDriver instance
      • Creating EventFiringWebDriver and EventListener instances
      • Registering EventListener with EventFiringWebDriver
      • Executing and verifying the events
        • Registering multiple EventListeners
    • Exploring different WebDriver event listeners
      • Listening for WebElement value change
      • Listening for WebElement clicked
      • Listening for a WebElement search event
      • Listening for browser back navigation
      • Listening for browser forward navigation
      • Listening for browser navigateTo events
      • Listening for script execution
      • Listening for any exception
      • Unregistering EventListener with EventFiringWebDriver
    • Summary
  • Chapter 6: Dealing with I/O
    • Learning about the FileHandler class
      • Copying files from the source to the destination directory
      • Copying files from the source to the destination directory based on filename suffix
      • Creating a directory
      • Deleting a file or directory
      • Understanding the IsZipped() method
      • Understanding the makeExecutable() method
      • Understanding the makeWritable() method
      • Reading a file
      • Understanding the canExecute() method
    • Learning about the TemporaryFilesystem class
      • Understanding the default temporary filesystem
      • Creating a directory in DefaultTmpFS
      • Deleting a temporary directory
      • Deleting multiple files
      • Changing the temporary filesystem
    • Learning about the Zip class
      • Compressing a directory
      • Decompressing a directory
    • Summary
  • Chapter 7: Exploring RemoteWebDriver and WebDriverBackedSelenium
    • Introducing RemoteWebDriver
      • Understanding the RemoteWebDriver server
        • Downloading the server
        • Running the server
      • Understanding the RemoteWebDriver client
        • Converting an existing test script to use RemoteWebDriver server
      • Using RemoteWebDriver for the Firefox browser
      • Using RemoteWebDriver and the IE browser
      • Using RemoteWebDriver and the Chrome browser
      • Extending the RemoteWebDriver client to take screenshots
    • Understanding the JSON wire protocol
    • Replacing the client library with your own code
    • Exploring WebDriverBackedSelenium
    • Summary
  • Chapter 8: Understanding Selenium Grid
    • Exploring Selenium Grid
    • Understanding the hub
    • Understanding the node
    • Modifying the existing test script to use Selenium Grid
      • Requesting for nonregistered capabilities
      • Queuing up the request if the node is busy
      • Dealing with two nodes with matching capabilities
    • Configuring Selenium Grid
      • Specifying node configuration parameters
        • Setting supported browsers by a node
        • Setting node timeouts
        • Setting the limit on browser instances
        • Reregistering the node automatically
        • Setting node health-check time
        • Unregistering an unavailable node
        • Setting the browser timeout
      • Hub configuration parameters
        • Waiting for a match of desired capability
        • Customized CapabilityMatcher
        • WaitTimeout for a new session
      • Different ways to specify the configuration
    • Summary
  • Chapter 9: Understanding PageObject Pattern
    • Creating test cases for our WordPress blog
      • Test case 1 – Adding a new post to our WordPress blog
      • Test case 2 – Deleting a post from our WordPress blog
      • Test case 3 – Counting the number of posts on our WordPress blog
    • What is the PageObject pattern?
      • Using the @FindBy annotation
      • Understanding PageFactory
    • Good practices for the PageObjects design
      • Consider a web page as a services provider
      • Always look for implied services
      • Using PageObjects within a PageObject
        • The AddNewPost PageObject
        • The AllPostsPage PageObject
      • Consider methods in PageObjects as services and not as User Actions
      • Identifying some WebElements on the fly
      • Keeping the page-specific details off the test script
    • Understanding loadable components
    • Working on an end-to-end example of WordPress
      • Looking at all the PageObjects
        • The AdminLoginPage PageObject
        • The AllPostsPage PageObject
        • The AddNewPostPage PageObject
        • The EditPostPage PageObject
        • The DeletePostPage PageObject
      • Looking at the test cases
        • Adding a new post
        • Editing a post
        • Deleting a post
        • Counting posts
    • Summary
  • Chapter 10: Testing iOS and Android Apps
    • Different forms of mobile applications
    • Available software tools
    • Automating iOS and Android tests using Appium
      • Automating iOS application tests
      • Automating Android application tests
      • Prerequisites for Appium
        • Setting up Xcode
        • Setting up Android SDK
      • Installing Appium
      • Automating for iOS
      • Automating for Android
    • Summary

Satya Avasarala

Satya Avasarala has rich experience in Java development and automation testing. He is an engineer in computer science. He has used WebDriver for many years now and has created several good automation frameworks. He has worked at various large software enterprises such as Oracle Corp, Yahoo! Inc., VMware Inc., and the REA Group.

In addition, he is also interested in Service Oriented Architectural design and Business Intelligence. He is an Oracle-certified Service Oriented Architecture Infrastructure Implementation Expert and a Business Intelligence Foundation Suite Implementation Specialist.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 2 submitted: last submission 29 May 2014

Page no: 64 | Errata type: Code

 
The given code is:

File scrFile = ((TakesScreenShot)driver).getScreenshotAs(OutputType.FILE);

 

It should be

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

Page no: 34 | Errata type: Code

 

The given code is:

public class sendKeys{

public static void main(String[] args){

WebDriver driver = new FirefoxDriver();

driver.get("http://www.google.com");

WebElement searchBox = driver.findElement(By.name("q"));

searchButton.sendKeys("Packt Publishing");

}

}

 

It should be

public class sendKeys{

public static void main(String[] args){

WebDriver driver = new FirefoxDriver();

driver.get("http://www.google.com");

WebElement searchBox = driver.findElement(By.name("q"));

searchBox.sendKeys("Packt Publishing");

}

}

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Selenium WebDriver Practical Guide +    Mastering Object-oriented Python =
50% Off
the second eBook
Price for both: ₨463.20

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Learn the basic design of Selenium WebDriver and understand how it overcomes the limitations of its predecessor
  • Set up and use Selenium Grid
  • Discover the various mechanisms used to locate web elements
  • Perform advanced actions such as drag-and-drop, double-click, right-click, and action builders on web pages
  • Explore the advanced features of WebDriver such as handling cookies, taking screenshotsmanaging timeouts, and browser navigations
  • Acquire an understanding of the various WebDriver implementations such as Firefox Driver, IE Driver, and Chrome Driver
  • Explore WebDriver EventListeners
  • Design effective automation frameworks using the PageObject pattern
  • Learn how to deal with the latest features of WebDriver

In Detail

Selenium WebDriver is an open source web UI automation tool implemented through a browser-specific browser driver, which sends commands to a browser and retrieves results.

Selenium WebDriver Practical Guide will guide you through the various APIs of WebDriver which should be used in automation tests, followed by a discussion of the various WebDriver implementations available. This guide will support you by offering you access to source code fi les, including the essential HTML  fi les, that allow you to work with jQuery and other examples throughout the book. Finally, you will receive an in-depth explanation of how to deal with the latest features of WebDriver through step-by-step practical tutorials.

Approach

An easy- to- follow guide, featuring step-by-step practical tutorials to help you understand how to automate web applications for testing purposes.

Who this book is for

If you are a quality assurance/testing professional, a software developer, or a web application developer looking to create automation test scripts for your web applications, this is the perfect guide for you! As a prerequisite, a basic knowledge of Core Java is expected, although any previous knowledge of WebDriver or Selenium 1 is not needed.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software