Book description
Learn end-to-end automation testing techniques for web and mobile browsers using Selenium WebDriver, AppiumDriver, Java, and TestNG
Key Features
- Explore the Selenium grid architecture and build your own grid for browser and mobile devices
- Use ExtentReports for processing results and SauceLabs for cloud-based test services
- Unlock the full potential of Selenium to test your web applications.
Book Description
Selenium WebDriver 3.x is an open source API for testing both browser and mobile applications. With the help of this book, you can build a solid foundation and can easily perform end-to-end testing on web and mobile browsers.You'll begin by being introduced to the Selenium Page Object Model for software development. You'll architect your own framework with a scalable driver class, Java utility classes, and support for third-party tools and plugins. You'll design and build a Selenium grid from scratch to enable the framework to scale and support different browsers, mobile devices, and platforms.You'll strategize and handle a rich web UI using the advanced WebDriver API and learn techniques to handle real-time challenges in WebDriver. You'll perform different types of testing, such as cross-browser testing, load testing, and mobile testing. Finally, you will also be introduced to data-driven testing, using TestNG to create your own automation framework.By the end of this Learning Path, you'll be able to design your own automation testing framework and perform data-driven testing with Selenium WebDriver.
This Learning Path includes content from the following Packt products:
- Selenium WebDriver 3 Practical Guide - Second Edition by Unmesh Gundecha
- Selenium Framework Design in Data-Driven Testing by Carl Cocchiaro
What you will learn
- Use different mobile and desktop browser platforms with Selenium 3
- Use the Actions API for performing various keyboard and mouse actions
- Design the Selenium Driver Class for local, remote, and third-party grid support
- Build page object classes with the Selenium Page Object Model
- Develop data-driven test classes using the TestNG framework
- Encapsulate data using the JSON protocol
- Build a Selenium Grid for RemoteWebDriver testing
- Build and use utility classes in synchronization, file I/O, reporting and test listener classes
Who this book is for
This Learning Path is ideal for software quality assurance/testing professionals, software project managers, or software developers interested in using Selenium for testing their applications. Professionals responsible for designing and building enterprise-based testing frameworks will also find this Learning Path useful. Prior programming experience in Java are TestNG is necessary.
Downloading the example code for this ebook: You can download the example code files for this ebook on GitHub at the following link: https://github.com/PacktPublishing/Learn-Selenium. If you require support please email: customercare@packt.com
Table of contents
- Title Page
- Copyright
- Contributors
- About Packt
- Preface
-
Introducing WebDriver and WebElements
- Selenium Testing Tools
- Differences between Selenium 2 and Selenium 3 
- Setting up a project in Eclipse with Maven and TestNG using Java
- WebElements
- Locating WebElements using WebDriver 
- Interacting with WebElements
- Summary
- Questions
- Further information
- Using Java 8 Features with Selenium
- Exploring the Features of WebDriver
-
Exploring Advanced Interactions of WebDriver
- Understanding the build and perform actions
-
Learning mouse based interactions
- The moveByOffset action
- The click at current location action
- The click on a WebElement action
- The click and hold at current location action
- The click and hold 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 double click at current location action
- The double click on WebElement action
- The context click on WebElement action
- The context click at current location action
- Learning keyboard-based interactions
- Summary
- Questions
- Further information
-
Understanding WebDriver Events
- Introducing the eventFiringWebDriver and eventListener classes 
- Creating an instance of EventListener 
-
Exploring different WebDriver event listeners
- Listening for WebElement value changes
- Listening for the clicked WebElement
- 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 an exception
- Unregistering EventListener with EventFiringWebDriver
- Performing accessibility testing
- Capturing page-performance metrics
- Summary
- Questions
- Further information
-
Exploring RemoteWebDriver
- Introducing RemoteWebDriver
- Understanding the JSON wire protocol                                                            
- Summary
- Questions
- Further information
-
Setting up Selenium Grid
- Exploring Selenium Grid
- Understanding the hub
- Understanding the node
-
Modifying the existing test script to use Selenium Grid
- Requesting for non-registered capabilities
- Queuing up the request if the node is busy 
- Dealing with two nodes with matching capabilities                                              
- Configuring Selenium Grid
- Using cloud-based grids for cross-browser testing
- Summary
- Questions
- Further information
- Data-Driven Testing with TestNG
-
Building a Scalable Selenium Test Driver Class for Web and Mobile Applications
- Introduction
- The singleton driver class
- Using preferences to support browsers and platforms
- Using preferences to support mobile device simulators, emulators, and real devices
- Multithreading support for parallel and distributed testing
- Passing optional arguments and parameters to the driver
- Selenium Grid Architecture support using the RemoteWebDriver and AppiumDriver classes
- Third-party grid architecture support including the Sauce Labs Test Cloud
- Using property files to select browsers, devices, versions, platforms, languages, and many more
- Summary
- Selenium Framework Utility Classes
-
Best Practices for Building Selenium Page Object Classes
- Introduction
- Best practices for naming conventions, comments, and folder structures
- Designing and building the abstract base classes for the AUT
- Designing and building subclasses for feature-specific pages using inheritance techniques
- Encapsulation and using getter/setter methods to retrieve objects from the page object classes
- Exception handling and synchronization in page object class methods
- Table classes
- Summary
- Defining WebDriver and AppiumDriver Page Object Elements
- Building a JSON Data Provider
-
Developing Data-Driven Test Classes
- Introduction
- Annotating test class methods using TestNG
- TestNG setup/teardown methods
- Naming conventions for test methods
- Using the TestNG DataProvider
- Calling page object methods in test classes
- Exception handling in test classes
- Designing base setup classes
- TestNG suite file structure
- Suite parameters
- Summary
-
Encapsulating Data in Data-Driven Testing
- Introduction
- Casting JSON data to Java objects
- Building in positive, negative, boundary, and limit testing
- Confirmation and exception property files
- Property files and parsing test data on the fly
- Global variables versus dynamic data
- Processing JVM args
- Retrieving JSON data outside of test methods
- Supporting multibranded applications
- Multiple driver support
- Parallel testing
- Summary
-
Designing a Selenium Grid
- Introduction
- Virtual grids
- Selenium driver class – WebDriver versus RemoteWebDriver
- Switching from local to remote driver
- Selenium standalone server and client drivers
- Selenium standalone server and browser driver command-line options
- Appium server and mobile simulator/emulator command-line options
- Selenium Grid console
- Directing traffic to Selenium nodes
- Third-Party Tools and Plugins
- Working Selenium WebDriver Framework Samples
- Assessments
- Other Books You May Enjoy
Product information
- Title: Learn Selenium
- Author(s):
- Release date: July 2019
- Publisher(s): Packt Publishing
- ISBN: 9781838983048
You might also like
book
Selenium Essentials
Get to grips with automated web testing with the amazing power of Selenium WebDriver In Detail …
book
Selenium WebDriver Quick Start Guide
Get writing tests and learn to design your own testing framework with Selenium WebDriver API Key …
video
Selenium Fundamentals
We’ll begin this course by understanding the importance of automating tests. Then, we will learn how …
book
Selenium WebDriver 3 Practical Guide - Second Edition
Real-world examples of cross-browser, mobile, and data-driven testing with all the latest features of Selenium WebDriver …