Class MouseElementActions

java.lang.Object
io.fluentlenium.core.action.MouseElementActions

public class MouseElementActions extends Object
Element specific mouse control interface. Triggers element search before performing an action.
  • Constructor Details

    • MouseElementActions

      public MouseElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
      Creates a new mouse element actions.
      Parameters:
      driver - selenium driver
      element - selenium element
    • MouseElementActions

      public MouseElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element, org.openqa.selenium.interactions.Actions actions)
      Creates a new mouse element actions.
      Parameters:
      driver - selenium driver
      element - selenium element
      actions - selenium actions
    • MouseElementActions

      public MouseElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement)
      Creates a new mouse element actions.
      Parameters:
      driver - selenium driver
      fluentWebElement - FluentWebElement
    • MouseElementActions

      public MouseElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement, org.openqa.selenium.interactions.Actions actions)
      Creates a new mouse element actions.
      Parameters:
      driver - selenium driver
      fluentWebElement - selenium FluentWebElement
      actions - selenium actions
  • Method Details

    • actions

      protected org.openqa.selenium.interactions.Actions actions()
    • clickAndHold

      public MouseElementActions 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

      public MouseElementActions 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

      public MouseElementActions 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

      public MouseElementActions 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

      public MouseElementActions 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

      public MouseElementActions moveToElement(org.openqa.selenium.WebElement target)
      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

      public MouseElementActions moveToElement(int xOffset, int yOffset)
      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 element
      yOffset - 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 element
      yOffset - 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

      public MouseElementActions 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

      public MouseElementActions 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.
      Parameters:
      source - element to emulate button down at
      Returns:
      this object reference to chain calls
      See Also:
      • Actions.dragAndDrop(WebElement, WebElement)
    • dragAndDropTo

      public MouseElementActions 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.
      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

      public MouseElementActions 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.
      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)