Package io.fluentlenium.core.action
Class KeyboardActions
java.lang.Object
io.fluentlenium.core.action.KeyboardActions
Execute actions with the keyboard.
-
Constructor Summary
ConstructorsConstructorDescriptionKeyboardActions(org.openqa.selenium.WebDriver driver) Creates a new object to execute actions with the keyboard, using given selenium driver. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.openqa.selenium.interactions.Actionsactions()Get selenium interactions actions.keyDown(org.openqa.selenium.Keys theKey) Performs a modifier key press.keyUp(org.openqa.selenium.Keys theKey) Performs a modifier key release.sendKeys(CharSequence... keysToSend) Sends keys to the active element.
-
Constructor Details
-
KeyboardActions
public KeyboardActions(org.openqa.selenium.WebDriver driver) Creates a new object to execute actions with the keyboard, using given selenium driver.- Parameters:
driver- selenium driver
-
-
Method Details
-
actions
protected org.openqa.selenium.interactions.Actions actions()Get selenium interactions actions.- Returns:
- selenium actions
-
keyDown
Performs a modifier key press. Does not release the modifier key - subsequent interactions may assume it's kept pressed. Note that the modifier key is never released implicitly - either keyUp(theKey) or sendKeys(Keys.NULL) must be called to release the modifier.- Parameters:
theKey- EitherKeys.SHIFT,Keys.ALTorKeys.CONTROL. If the provided key is none of those,IllegalArgumentExceptionis thrown.- Returns:
- this object reference to chain calls
- See Also:
-
keyUp
Performs a modifier key release. Releasing a non-depressed modifier key will yield undefined behaviour.- Parameters:
theKey- EitherKeys.SHIFT,Keys.ALTorKeys.CONTROL.- Returns:
- this object reference to chain calls
- See Also:
-
sendKeys
Sends keys to the active element. This differs from callingWebElement.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:
- A self reference.
- See Also:
-