Class MouseElementActions
-
Constructor Summary
ConstructorsConstructorDescriptionMouseElementActions
(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement) Creates a new mouse element actions.MouseElementActions
(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) Creates a new mouse element actions. -
Method Summary
Modifier and TypeMethodDescriptionorg.openqa.selenium.interactions.Mouse
basic()
Deprecated.Use the following mapping for updating your code:click()
Clicks in the middle of the given element.Clicks (without releasing) in the middle of the given element.Performs a context-click at middle of the given element.Performs a double-click at middle of the given element.dragAndDropBy
(int xOffset, int yOffset) A convenience method that performs click-and-hold at the location of this element, moves by a given offset, then releases the mouse.dragAndDropByWithTargetOffset
(org.openqa.selenium.WebElement target, int xOffset, int yOffset) A convenience method that performs click-and-hold at the location of this element, moves by a given offset of target element, then releases the mouse.dragAndDropFrom
(org.openqa.selenium.WebElement source) A convenience method that performs click-and-hold at the location of the source element, moves to the location of this element (target), then releases the mouse.dragAndDropTo
(org.openqa.selenium.WebElement target) A convenience method that performs click-and-hold at the location of this element (source), moves to the location of the target element, then releases the mouse.Moves the mouse to the middle of the element.moveToElement
(int xOffset, int yOffset) Moves the mouse to an offset from the top-left corner of the element.moveToElement
(org.openqa.selenium.WebElement target) Moves the mouse to the middle of the target element.moveToElement
(org.openqa.selenium.WebElement target, int xOffset, int yOffset) Moves the mouse to an offset from the top-left corner of the target element.release()
Releases the depressed left mouse button, in the middle of the given element.
-
Constructor Details
-
MouseElementActions
public MouseElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) Creates a new mouse element actions.- Parameters:
driver
- selenium driverelement
- selenium element
-
MouseElementActions
public MouseElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement) Creates a new mouse element actions.- Parameters:
driver
- selenium driverfluentWebElement
- FluentWebElement
-
-
Method Details
-
basic
Deprecated.Use the following mapping for updating your code:Mouse.click(Coordinates)
toclick()
Mouse.doubleClick(Coordinates)
todoubleClick()
Mouse.mouseDown(Coordinates)
tomoveToElement()
thenclickAndHold()
Mouse.mouseUp(Coordinates)
torelease()
Mouse.mouseMove(Coordinates)
tomoveToElement()
Mouse.mouseMove(Coordinates, long, long)
tomoveToElement(int, int)
Mouse.contextClick(Coordinates)
tocontextClick()
Basic mouse operations- Returns:
- low level interface to control the mouse
-
clickAndHold
Clicks (without releasing) in the middle of the given element. This is equivalent to: Actions.moveToElement(onElement).clickAndHold()- Returns:
- this object reference to chain calls
- See Also:
-
Actions.clickAndHold(WebElement)
-
release
Releases the depressed left mouse button, in the middle of the given element. This is equivalent to: Actions.moveToElement(onElement).release()Invoking this action without invoking
clickAndHold()
first will result in undefined behaviour.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.release(WebElement)
-
click
Clicks in the middle of the given element. Equivalent to: Actions.moveToElement(onElement).click()- Returns:
- this object reference to chain calls
- See Also:
-
Actions.click(WebElement)
-
doubleClick
Performs a double-click at middle of the given element. Equivalent to: Actions.moveToElement(element).doubleClick()- Returns:
- this object reference to chain calls
- See Also:
-
Actions.doubleClick(WebElement)
-
moveToElement
Moves the mouse to the middle of the element. The element is scrolled into view and its location is calculated using getBoundingClientRect.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.moveToElement(WebElement)
-
moveToElement
Moves the mouse to the middle of the target element. The element is scrolled into view and its location is calculated using getBoundingClientRect.- Parameters:
target
- element to move to and release the mouse at.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.moveToElement(WebElement)
-
moveToElement
Moves the mouse to an offset from the top-left corner of the element. The element is scrolled into view and its location is calculated using getBoundingClientRect.- Parameters:
xOffset
- Offset from the top-left corner. A negative value means coordinates left from the elementyOffset
- Offset from the top-left corner. A negative value means coordinates above the element- Returns:
- this object reference to chain calls
- See Also:
-
Actions.moveToElement(WebElement, int, int)
-
moveToElement
public MouseElementActions moveToElement(org.openqa.selenium.WebElement target, int xOffset, int yOffset) Moves the mouse to an offset from the top-left corner of the target element. The element is scrolled into view and its location is calculated using getBoundingClientRect.- Parameters:
target
- element to move to and release the mouse at.xOffset
- Offset from the top-left corner. A negative value means coordinates left from the elementyOffset
- Offset from the top-left corner. A negative value means coordinates above the element- Returns:
- this object reference to chain calls
- See Also:
-
Actions.moveToElement(WebElement, int, int)
-
contextClick
Performs a context-click at middle of the given element. First performs a mouseMove to the location of the element.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.contextClick(WebElement)
-
dragAndDropFrom
A convenience method that performs click-and-hold at the location of the source element, moves to the location of this element (target), then releases the mouse.- Parameters:
source
- element to emulate button down at- Returns:
- this object reference to chain calls
- See Also:
-
Actions.dragAndDrop(WebElement, WebElement)
-
dragAndDropTo
A convenience method that performs click-and-hold at the location of this element (source), moves to the location of the target element, then releases the mouse.- Parameters:
target
- element to move to and release the mouse at.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.dragAndDrop(WebElement, WebElement)
-
dragAndDropBy
A convenience method that performs click-and-hold at the location of this element, moves by a given offset, then releases the mouse.- Parameters:
xOffset
- horizontal move offset.yOffset
- vertical move offset.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.dragAndDropBy(WebElement, int, int)
-
dragAndDropByWithTargetOffset
public MouseElementActions dragAndDropByWithTargetOffset(org.openqa.selenium.WebElement target, int xOffset, int yOffset) A convenience method that performs click-and-hold at the location of this element, moves by a given offset of target element, then releases the mouse.This Method is not available in pure Selenium
- Parameters:
target
- element to move to and release the mouse at.xOffset
- horizontal move offset.yOffset
- vertical move offset.- Returns:
- this object reference to chain calls
- See Also:
-
Actions.dragAndDropBy(WebElement, int, int)
-