Using Advanced User Interactions API for mouse and keyboard events

The Selenium WebDriver's Advanced User Interactions API allows us to perform operations from keyboard events and simple mouse events to complex events such as dragging-and-dropping, holding a key and then performing mouse operations by using the Actions class, and building a complex chain of events exactly like a user doing these manually.

The Actions class implements the builder pattern to create a composite action containing a group of other actions.

In this recipe, we will use the Actions class to build a chain of events to select rows in a table.

How to do it...

Let's create a test to select the multiple rows from different positions in a table using the Ctrl key. We can select ...

Get Selenium Testing Tools Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.