The moveByOffset action

The moveByOffset() method is used to move the mouse from its current position to another point on the web page. Developers can specify the x distance and the y distance the mouse has to be moved. When the page is loaded, generally the initial position of the mouse would be (0, 0), unless there is an explicit focus declared by the page.

The API syntax for the moveByOffset() method is as follows:

 public Actions moveByOffset(int xOffSet, int yOffSet)

In the preceding code, xOffSet is the input parameter providing the WebDriver the amount of offset to be moved along the x axis. A positive value is used to move the cursor to the right, and a negative value is used to move the cursor to the left.

yOffSet is the input parameter ...

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.