Book Image

Selenium WebDriver 3 Practical Guide - Second Edition

By : Pallavi Sharma, UNMESH GUNDECHA, Satya Avasarala
Book Image

Selenium WebDriver 3 Practical Guide - Second Edition

By: Pallavi Sharma, UNMESH GUNDECHA, Satya Avasarala

Overview of this book

Selenium WebDriver is an open source automation tool implemented through a browser-specific driver, which sends commands to a browser and retrieves results. The latest version of Selenium 3 brings with it a lot of new features that change the way you use and setup Selenium WebDriver. This book covers all those features along with the source code, including a demo website that allows you to work with an HMTL5 application and other examples throughout the book. Selenium WebDriver 3 Practical Guide will walk you through the various APIs of Selenium WebDriver, which are used in automation tests, followed by a discussion of the various WebDriver implementations available. You will learn to strategize and handle rich web UI using advanced WebDriver API along with real-time challenges faced in WebDriver and solutions to handle them. You will discover different types and domains of testing such as cross-browser testing, load testing, and mobile testing with Selenium. Finally, you will also be introduced to data-driven testing using TestNG to create your own automation framework. By the end of this book, you will be able to select any web application and automate it the way you want.
Table of Contents (14 chapters)

What this book covers

Chapter 1, Introducing WebDriver and WebElements, will start off with an overview of Selenium and the features. Then, we quickly jump into WebDriver by describing how it perceives a web page. We will also look at what a WebDriver's WebElement is. Then, we talk about locating WebElements on a web page and performing some basic actions on them.

Chapter 2, Working with Browser Drivers, will talk about various implementations of WebDriver, such as FirefoxDriver, IEDriver, and ChromeDriver. We will configure browser options to run tests in headless mode, mobile emulation, and use custom profiles. With WebDriver becoming a W3C specification, all major browser vendors now support WebDriver natively in the browser.

Chapter 3, Using Java 8 Features along with Selenium, will talk about prominent Java 8 features such as Streams API and Lambda expressions for processing the list of WebElements. The Stream API and Lambda expression help in applying functional programming style to create readable and fluent tests.

Chapter 4, Exploring the Features of WebDriver, will talk about some advanced features of WebDriver, such as taking screenshots of web pages, executing JavaScript, handling cookies, and handling Windows and Frames.

Chapter 5, Exploring Advanced Interaction API, will dive deeply into more advanced actions that WebDriver can perform on the WebElements of a web page, such as the dragging and dropping of elements from one frame of a page to another and right/context-clicking on WebElements. We're sure you will find this chapter interesting to read.

Chapter 6, Understanding WebDriver Events, will deal with the event-handling aspect of WebDriver. To state a few, events can be a value change on a WebElement, a browser back-navigation invocation, script execution completion, and so on. We will use these events to run accessibility and performance checks.

Chapter 7, Exploring RemoteWebDriver, will talk about using RemoteWebDriver and Selenium Standalone Server for executing tests on remote machines from your machine. You can use the RemoteWebDriver class to communicate with the Selenium Standalone Server on a remote machine to run commands on the desired browser installed on the remote machine. One of its popular use cases is browser compatibility testing.

Chapter 8, Setting up Selenium Grid, will talk about one important and interesting feature of Selenium named Selenium Grid. Using this, you can execute automated tests on a distributed computer network using Selenium Grid. We will configure a Hub and Nodes for cross-browser testing. This also enables running tests in parallel and in a distributed architecture.

Chapter 9, The PageObject Pattern, will talk about a well-known design pattern named the PageObject pattern. This is a proven pattern that will give you a better handle on your automation framework and scenarios for better maintainability.

Chapter 10, Mobile Testing on iOS and Android Using Appium, will take you through how WebDriver can be used to automate your test scripts for iOS and Android platform using Appium.

Chapter 11, Data-Driven Testing with TestNG, will talk about using the data-driven testing technique with TestNG. Using the data-driven testing approach, we can reuse a test with multiple sets of test data to gain additional coverage.