Class KeyboardElementActions

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

public class KeyboardElementActions extends Object
Execute actions with the keyboard on a defined element. Triggers element search before performing an action.
  • Constructor Summary

    Constructors
    Constructor
    Description
    KeyboardElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement)
    Creates a new object to execute actions with the keyboard, using given selenium driver and element.
    KeyboardElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement, org.openqa.selenium.interactions.Actions actions)
    Creates a new object to execute actions with the keyboard, using given selenium driver and element.
    KeyboardElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
    Creates a new object to execute actions with the keyboard, using given selenium driver and element.
    KeyboardElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element, org.openqa.selenium.interactions.Actions actions)
    Creates a new object to execute actions with the keyboard, using given selenium driver and element.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.openqa.selenium.interactions.Actions
    Get selenium interactions actions.
    keyDown(org.openqa.selenium.Keys theKey)
    Performs a modifier key press after focusing on an element.
    keyUp(org.openqa.selenium.Keys theKey)
    Performs a modifier key release after focusing on an element.
    sendKeys(CharSequence... keysToSend)
    Sends keys to the active element.

    Methods inherited from class java.lang.Object

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

    • KeyboardElementActions

      public KeyboardElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
      Creates a new object to execute actions with the keyboard, using given selenium driver and element.
      Parameters:
      driver - selenium driver
      element - element on which to execute actions
    • KeyboardElementActions

      public KeyboardElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement)
      Creates a new object to execute actions with the keyboard, using given selenium driver and element.
      Parameters:
      driver - selenium driver
      fluentWebElement - FluentWebElement on which to execute actions
    • KeyboardElementActions

      public KeyboardElementActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element, org.openqa.selenium.interactions.Actions actions)
      Creates a new object to execute actions with the keyboard, using given selenium driver and element.
      Parameters:
      driver - selenium driver
      element - element on which to execute actions
    • KeyboardElementActions

      public KeyboardElementActions(org.openqa.selenium.WebDriver driver, FluentWebElement fluentWebElement, org.openqa.selenium.interactions.Actions actions)
      Creates a new object to execute actions with the keyboard, using given selenium driver and element.
      Parameters:
      driver - selenium driver
      fluentWebElement - FluentWebElement on which to execute actions
  • Method Details

    • actions

      protected org.openqa.selenium.interactions.Actions actions()
      Get selenium interactions actions.
      Returns:
      selenium actions
    • keyDown

      public KeyboardElementActions keyDown(org.openqa.selenium.Keys theKey)
      Performs a modifier key press after focusing on an element. Equivalent to: Actions.click(element).sendKeys(theKey);
      Parameters:
      theKey - Either Keys.SHIFT, Keys.ALT or Keys.CONTROL. If the provided key is none of those, IllegalArgumentException is thrown.
      Returns:
      this object reference to chain calls
      See Also:
    • keyUp

      public KeyboardElementActions keyUp(org.openqa.selenium.Keys theKey)
      Performs a modifier key release after focusing on an element. Equivalent to: Actions.click(element).sendKeys(theKey);
      Parameters:
      theKey - Either Keys.SHIFT, Keys.ALT or Keys.CONTROL.
      Returns:
      this object reference to chain calls
      See Also:
      • Actions.keyUp(WebElement, CharSequence)
    • sendKeys

      public KeyboardElementActions sendKeys(CharSequence... keysToSend)
      Sends keys to the active element. This differs from calling WebElement.sendKeys(CharSequence...) on the active element in two ways:
      • The modifier keys included in this call are not released.
      • There is no attempt to re-focus the element - so sendKeys(Keys.TAB) for switching elements should work.
      Parameters:
      keysToSend - The keys.
      Returns:
      this object reference to chain calls
      See Also:
      • Actions.sendKeys(WebElement, CharSequence...)