Action Class in Selenium is a built-in feature provided by the selenium for handling keyboard and mouse events. It includes various operations such as multiple events clicking by control key, drag and drop events and many more.
clickAndHold() – Clicks (without releasing) at the current mouse location.
contextClick()– Performs a context-click at the current mouse location. (Right Click Mouse Action)
doubleClick() Performs a double-click at the current mouse location.
dragAndDrop(source, target) – Performs click-and-hold at the location of the source element, moves to the location of the target element, then releases the mouse.
dragAndDropBy(source, x-offset, y-offset) – Performs click-and-hold at the location of the source element, moves by a given offset, then releases the mouse.
keyDown(modifier_key) – Performs a modifier key press. Does not release the modifier key – subsequent interactions may assume it’s kept pressed.
modifier_key – any of the modifier keys (Keys.ALT, Keys.SHIFT, or Keys.CONTROL)
keyUp(modifier _key) – Performs a key release.
moveByOffset(x-offset, y-offset) – Moves the mouse from its current position (or 0,0) by the given offset.
moveToElement(toElement) – Moves the mouse to the middle of the element.
release() – Releases the depressed left mouse button at the current mouse location
sendKeys(onElement, charsequence) – Sends a series of keystrokes onto the element.