The click and hold at current location action

The clickAndHold() method is another method of the actions class that left-clicks on an element and holds it without releasing the left button of the mouse. This method will be useful when executing operations such as drag and drop. This method is one of the variants of the clickAndHold() method that the actions class provides. We will discuss the other variant in the next section.

Now open the Sortable.html file that came with the book. You can see that the tiles can be moved from one position to the other. Now let's try to move tile 3 to the position of tile 2. The sequence of steps that are involved to do this are the following:

  1. Move the cursor to the position of tile 3.
  2. Click and hold tile ...

Get Selenium WebDriver 3 Practical Guide - Second Edition 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.