Hands-On Selenium WebDriver with Java: A Deep Dive into the Development of End-to-End Tests
Get started with Selenium WebDriver, the open source library for automating tests to ensure your web application performs as expected. In this practical hands-on book, author Boni Garcia takes Java developers through Selenium's main features for automating web navigation, browser manipulation, web element interaction, and more, with ready-to-be-executed test examples.

You'll start by learning the core features of Selenium (composed of WebDriver, Grid, and IDE) and its ecosystem. Discover why Selenium WebDriver is the de facto library for developing end-to-end tests on your web application. You'll explore ways to use advanced Selenium WebDriver features, including using web browsers in Docker containers or the DevTools protocol. Selenium WebDriver examples in this book are available on GitHub.

With this book, you'll learn how to:

  • Set up a Java project containing end-to-end tests that use Selenium WebDriver
  • Conduct automated interaction with web applications
  • Use strategies for managing browser-specific capabilities and cross-browser testing
  • Interact with web forms, manage pop-up messages, and execute JavaScript
  • Control remote browsers and use advanced browser infrastructure for Selenium WebDriver tests in the cloud
  • Model web pages using object-oriented classes to ease test maintenance and reduce code duplication
1140929718
Hands-On Selenium WebDriver with Java: A Deep Dive into the Development of End-to-End Tests
Get started with Selenium WebDriver, the open source library for automating tests to ensure your web application performs as expected. In this practical hands-on book, author Boni Garcia takes Java developers through Selenium's main features for automating web navigation, browser manipulation, web element interaction, and more, with ready-to-be-executed test examples.

You'll start by learning the core features of Selenium (composed of WebDriver, Grid, and IDE) and its ecosystem. Discover why Selenium WebDriver is the de facto library for developing end-to-end tests on your web application. You'll explore ways to use advanced Selenium WebDriver features, including using web browsers in Docker containers or the DevTools protocol. Selenium WebDriver examples in this book are available on GitHub.

With this book, you'll learn how to:

  • Set up a Java project containing end-to-end tests that use Selenium WebDriver
  • Conduct automated interaction with web applications
  • Use strategies for managing browser-specific capabilities and cross-browser testing
  • Interact with web forms, manage pop-up messages, and execute JavaScript
  • Control remote browsers and use advanced browser infrastructure for Selenium WebDriver tests in the cloud
  • Model web pages using object-oriented classes to ease test maintenance and reduce code duplication
65.99 In Stock
Hands-On Selenium WebDriver with Java: A Deep Dive into the Development of End-to-End Tests

Hands-On Selenium WebDriver with Java: A Deep Dive into the Development of End-to-End Tests

by Boni Garcia
Hands-On Selenium WebDriver with Java: A Deep Dive into the Development of End-to-End Tests

Hands-On Selenium WebDriver with Java: A Deep Dive into the Development of End-to-End Tests

by Boni Garcia

Paperback

$65.99 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Get started with Selenium WebDriver, the open source library for automating tests to ensure your web application performs as expected. In this practical hands-on book, author Boni Garcia takes Java developers through Selenium's main features for automating web navigation, browser manipulation, web element interaction, and more, with ready-to-be-executed test examples.

You'll start by learning the core features of Selenium (composed of WebDriver, Grid, and IDE) and its ecosystem. Discover why Selenium WebDriver is the de facto library for developing end-to-end tests on your web application. You'll explore ways to use advanced Selenium WebDriver features, including using web browsers in Docker containers or the DevTools protocol. Selenium WebDriver examples in this book are available on GitHub.

With this book, you'll learn how to:

  • Set up a Java project containing end-to-end tests that use Selenium WebDriver
  • Conduct automated interaction with web applications
  • Use strategies for managing browser-specific capabilities and cross-browser testing
  • Interact with web forms, manage pop-up messages, and execute JavaScript
  • Control remote browsers and use advanced browser infrastructure for Selenium WebDriver tests in the cloud
  • Model web pages using object-oriented classes to ease test maintenance and reduce code duplication

Product Details

ISBN-13: 9781098110000
Publisher: O'Reilly Media, Incorporated
Publication date: 05/10/2022
Pages: 419
Product dimensions: 7.00(w) x 9.19(h) x (d)

About the Author

Boni Garcia is a Visiting Professor at Universidad Carlos III de Madrid (UC3M) in Spain. He is passionate about software engineering with a big emphasis on automated testing. He is the author of more than 40 publications, including international conferences, journals, book chapters, and the book "Mastering Software Testing with JUnit 5." He is the creator and maintainer of different open-source projects related to Selenium, including WebDriverManager (a well-known helper library for Selenium WebDriver in Java) and Selenium-Jupiter (a JUnit 5 extension for Selenium WebDriver).
He presented his PhD dissertation, focused on automated web navigation and testing, in 2011. The reference implementation of this work used Selenium IDE and Remote Control (RC) as foundational tools. He continued researching automated testing from 2013 to 2020, participating in the open-source projects Kurento, OpenVidu, and ElasTest. In this period, he adopted Selenium WebDriver as the fundamental framework to assess WebRTC applications and Quality of Experience (QoE). Currently, he continues working actively with Selenium. His latest publications focus on the Selenium ecosystem and automated driver management in Selenium WebDriver.

Table of Contents

Foreword xi

Preface xv

Part I Introduction

1 A Primer on Selenium 3

Selenium Core Components 3

Selenium WebDriver 5

Selenium Grid 6

Selenium IDE 8

Selenium Ecosystem 10

Language Bindings 10

Driver Managers 11

Locator Tools 12

Frameworks 12

Browser Infrastructure 14

Community 15

Software Testing Fundamentals 16

Levels of Testing 16

Types of Testing 19

Testing Methodologies 21

Test Automation Tools 24

Summary and Outlook 28

2 Preparing for Testing 29

Requirements 29

Java Virtual Machine 30

Text Editor or IDE 30

Browsers and Drivers 30

Build Tools 31

Optional Software 31

Project Setup 32

Project Layout 32

Dependencies 34

Hello World 45

Using Additional Browsers 48

Summary and Outlook 49

Part II The Selenium WebDriver API

3 WebDriver Fundamentals 53

Basic WebDriver Usage 53

WebDriver Creation 53

WebDriver Methods 57

Session Identifier 58

WebDriver Disposal 59

Locating WebElements 59

The Document Object Model (DOM) 59

WebElement Methods 61

Location Strategies 62

Finding Locators on a Web Page 72

Compound Locators 74

Relative Locators 76

What Strategy Should You Use? 80

Keyboard Actions 82

File Uploading 83

Range Sliders 84

Mouse Actions 85

Web Navigation 85

Checkboxes and Radio Buttons 86

User Gestures 86

Right-Click and Double-Click 88

Mouseover 89

Drag and Drop 90

Click and Hold 92

Copy and Paste 92

Waiting Strategies 94

Implicit Wait 94

Explicit Wait 96

Fluent Wait 98

Summary and Outlook 100

4 Browser-Agnostic Features 101

Executing JavaScript 101

Synchronous Scripts 102

Pinned Scripts 108

Asynchronous Scripts 109

Timeouts 110

Page Loading Timeout 110

Script Loading Timeout 111

Screenshots 112

WebElement Screenshots 115

Window Size and Position 116

Browser History 117

The Shadow DOM 118

Cookies 120

Dropdown Lists 125

Data List Elements 127

Navigation Targets 128

Tabs and Windows 129

Frames and Iframes 131

Dialog Boxes 133

Alerts, Confirms, and Prompts 134

Modal Windows 136

Web Storage 137

Event Listeners 138

WebDriver Exceptions 142

Summary and Outlook 144

5 Browser-Specific Manipulation 145

Browser Capabilities 145

Headless Browser 147

Page Loading Strategies 151

Device Emulation 153

Web Extensions 155

Geolocation 160

Notifications 162

Browser Binary 165

Web Proxies 166

Log Gathering 168

Get User Media 169

Loading Insecure Pages 171

Localization 173

Incognito 175

Edge in Internet Explorer Mode 175

The Chrome DevTools Protocol 177

CDP Selenium Wrappers 177

CDP Raw Commands 180

Location Context 191

Web Authentication 191

Print Page 193

WebDriver BiDi 194

Summary and Outlook 196

6 Remote WebDriver 197

Selenium WebDriver Architecture 197

Creation of Remote Web Driver Objects 199

RemoteWebDriver Constructor 199

RemoteWebDriver Builder 201

WebDriverManager Builder 201

Selenium-Jupiter 202

Selenium Grid 203

Standalone 203

Hub-nodes 207

Fully Distributed 208

Observability 213

Configuration 216

Cloud Providers 217

Browsers in Docker Containers 219

Docker Images for Selenium Grid 220

Selenoid 222

WebDriverManager 224

Selenium-Jupiter 227

Summary and Outlook 228

Part III Advanced Concepts

7 The Page Object Model (POM) 231

Motivation 231

The POM Design Pattern 232

Page Objects 234

Robust Page Objects 236

Creating a Domain Specific Language (DSL) 240

Page Factory 242

Summary and Outlook 244

8 Testing Framework Specifics 245

Parameterized Tests 245

Cross-Browser Testing 252

Categorizing and Filtering Tests 256

Ordering Tests 261

Failure Analysis 265

Retrying Tests 273

Parallel Test Execution 278

Test Listeners 282

Disabled Tests 286

Summary and Outlook 289

9 Third-Party Integrations 291

File Download 291

Using Browser-Specific Capabilities 292

Using an HTTP Client 294

Capture Network Traffic 296

Nonfunctional Testing 298

Performance 298

Security 303

Accessibility 306

A/B Testing 307

Fluent API 308

Test Data 309

Reporting 312

Behavior Driven Development 316

Web Frameworks 320

Summary and Outlook 322

10 Beyond Selenium 325

Mobile Apps 325

Mobile Testing 326

Appium 327

REST Services 332

REST Assured 334

Alternatives to Selenium 336

Cypress 336

WebDriverIO 339

TestCafe 340

Puppeteer 341

Playwright 342

Summary and Final Remarks 344

A What's New in Selenium 4 345

B Driver Management 351

C Examples Repository Setup 359

Index 379

From the B&N Reads Blog

Customer Reviews