Created
February 26, 2021 15:40
-
-
Save ultimate-qa2/ac6d4dd97252ae0ea33f567d8c5ac0b5 to your computer and use it in GitHub Desktop.
Mouse actions in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clicks in the middle of the given element. | |
click(WebElement target); | |
// Clicks (without releasing) at the current mouse location. | |
clickAndHold(WebElement target); | |
// Performs a context-click at middle of the given element. First performs a mouseMove to the location of the element. | |
contextClick(WebElement target); | |
// Performs a double-click at middle of the given element. | |
doubleClick(WebElement target); | |
// A convenience method that performs click-and-hold at the location of the source element, | |
// moves to the location of the target element, then releases the mouse. | |
dragAndDrop(WebElement source, WebElement target); | |
// A convenience method that performs click-and-hold at the location of the source element, | |
// moves by a given offset, then releases the mouse. | |
dragAndDrop(WebElement source, int xOffset, int yOffset); | |
// Moves the mouse to the middle of the element. | |
moveToElement(WebElement target); | |
// Moves the mouse to an offset from the top-left corner of the element. | |
moveToElement(WebElement source, int xOffset, int yOffset); | |
// Releases the depressed left mouse button at the current mouse location. | |
release(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment