Action Class
perform operations from keyboard events and mouse events (even dragging-and-dropping, holding a key and then performing mouse operations, ..)
we can building a complex chain of events exactly like a user doing these manually
The Actions class implements the builder pattern to create a composite action containing a group of other actions.
We need to create an instance of the Actions class by passing the instance of driver class to the constructor in the following way:
Actions a = new Actions(driver);
then we can use the methods of the action Class like MouseOver, ContextClick/RightClick, DoubleClick ...
a.moveToElement(element).conextClick().build().performe();
- before performing the action, you have to build the entire element. that enables to composit actions
- to execute it you have to invoke performe() !
a.moveToElement(textbox).click().keyDown(Keys.SHIFT).sendKeys("hello").build().performe();
Top comments (0)