Class MouseActions


  • public class MouseActions
    extends java.lang.Object
    Execute actions with the mouse.
    • Constructor Summary

      Constructors 
      Constructor Description
      MouseActions​(org.openqa.selenium.WebDriver driver)
      Creates a new mouse actions.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected org.openqa.selenium.interactions.Actions actions()
      Get the actions object.
      org.openqa.selenium.interactions.Mouse basic()
      Deprecated.
      Use the following mapping for updating your code:
      MouseActions click()
      Clicks at the current mouse location.
      MouseActions clickAndHold()
      Clicks (without releasing) at the current mouse location.
      MouseActions contextClick()
      Performs a context-click at the current mouse location.
      MouseActions doubleClick()
      Performs a double-click at the current mouse location.
      MouseActions moveByOffset​(int xOffset, int yOffset)
      Moves the mouse from its current position (or 0,0) by the given offset.
      MouseActions release()
      Releases the depressed left mouse button at the current mouse location.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MouseActions

        public MouseActions​(org.openqa.selenium.WebDriver driver)
        Creates a new mouse actions.
        Parameters:
        driver - driver
    • Method Detail

      • actions

        protected org.openqa.selenium.interactions.Actions actions()
        Get the actions object.
        Returns:
        actions object
      • clickAndHold

        public MouseActions clickAndHold()
        Clicks (without releasing) at the current mouse location.
        Returns:
        this object reference to chain calls
        See Also:
        Actions.clickAndHold()
      • release

        public MouseActions release()
        Releases the depressed left mouse button at the current mouse location.
        Returns:
        this object reference to chain calls
        See Also:
        Actions.release()
      • click

        public MouseActions click()
        Clicks at the current mouse location. Useful when combined with
        Returns:
        this object reference to chain calls
        See Also:
        Actions.click()
      • doubleClick

        public MouseActions doubleClick()
        Performs a double-click at the current mouse location.
        Returns:
        this object reference to chain calls
      • contextClick

        public MouseActions contextClick()
        Performs a context-click at the current mouse location.
        Returns:
        this object reference to chain calls
        See Also:
        Actions.contextClick()
      • moveByOffset

        public MouseActions moveByOffset​(int xOffset,
                                         int yOffset)
        Moves the mouse from its current position (or 0,0) by the given offset. If the coordinates provided are outside the viewport (the mouse will end up outside the browser window) then the viewport is scrolled to match.
        Parameters:
        xOffset - horizontal offset. A negative value means moving the mouse left.
        yOffset - vertical offset. A negative value means moving the mouse up.
        Returns:
        this object reference to chain calls
        See Also:
        Actions.moveByOffset(int, int)