Skip to Main Content
Hands-On Selenium WebDriver with Java
book

Hands-On Selenium WebDriver with Java

by Boni Garcia
March 2022
Intermediate to advanced content levelIntermediate to advanced
419 pages
9h 59m
English
O'Reilly Media, Inc.
Book available
Content preview from Hands-On Selenium WebDriver with Java

Chapter 3. WebDriver Fundamentals

This chapter presents the elementary aspects of the Selenium WebDriver API. To that aim, we review first the different ways to create instances of the WebDriver hierarchy (e.g., ChromeDriver, EdgeDriver, FirefoxDriver, etc.). Also, we explore the main methods available in these objects. Among them, locating the different elements in a web page is essential. Thus, you will discover the possible locators, i.e., strategies to find the elements within a web page (called WebElement in the Selenium WebDriver API), such as by tag name, link text, HTML attribute (identifier, name, or class), CSS selector, or XPath. Another critical aspect of the Selenium WebDriver API covered in this chapter is the impersonation of user actions (i.e., automated interactions with web pages using the keyboard and mouse). The last part of this chapter presents the ability to wait for web elements. This feature is critical due to the dynamic and asynchronous nature of web applications.

Basic WebDriver Usage

This section covers three fundamental aspects related to WebDriver objects. First, we review the different ways to create them. Second, we study their basic operations. Finally, we analyze the different ways to dispose of these objects (typically at the end of a test, for closing the browser).

WebDriver Creation

As introduced in Chapter 2, to control browsers with Selenium WebDriver in Java, the first step is to create WebDriver instances. Thus, we need to create a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Selenium WebDriver with Java - Basics to Advanced and Frameworks

Selenium WebDriver with Java - Basics to Advanced and Frameworks

Rahul Shetty

Publisher Resources

ISBN: 9781098109998Errata PageSupplemental Content