Book Image

Selenium Essentials

By : Prashanth Sams
Book Image

Selenium Essentials

By: Prashanth Sams

Overview of this book

Table of Contents (12 chapters)

Mouse and keyboard actions

In Selenium WebDriver, actions can be either mouse actions or keyboard actions. The selenium-based Actions API provides support to click on a particular location with or without elements and use keyboard shortcuts efficiently.

  • The build() method generates all the composite actions. The following is the syntax for this function:;

    The following code snippet explains to you how you can generate actions using the build() method:

    Actions action = new Actions(driver);"path")));;
  • The click() method performs a mouse click on the current mouse pointer location. The following is the syntax for this function:;"path")));

    Unlike clicking on the mouse's current location, this function allows you to click on an element by locating it (using the Actions class). Please check the following snippet for both cases: