Skip to content

TestingWithSK/selenium-actions-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium – Actions Class

Java Selenium

Read the complete Blog - How to use Actions Class in Selenium

In this article, you will learn about the Actions class and their example. Selenium provides different methods to perform click, input text, and select from dropdowns and tables. However, there are such complex actions that we need to perform like drag and drop, double click, right-click, and, many more. These actions can not be handled by simple web element commands. To handle those types of action, selenium provides Actions Class. Actions class is used to handle Keyboard and Mouse events.

Actions Methods

Methods Description
clickAndHold() Clicks an element without releasing it.
contextClick() Performs Mouse right-click on a given element
doubleClick() Performs double click on a given element
dragAndDrop(source, target) Click and hold the source element and move to the target location and then release
sendKeys() Sends a series of Keys to the given element.
keyDown(KEY) Perform press the given KEY and do not release.KEY – Keys.ALT, Keys.SHIFT, Keys.CONTROL, etc.
keyUp(KEY) Perform release of the given KEY.
moveByOffset(X-offset, Y-offset) Moves the mouse to the given offset (X, Y)
moveToElement(WebElement) Moves the mouse to the middle of the given element.

Clone the repository using -

git clone https://github.com/TestingWithSK/selenium-actions-demo.git

KeyBoard Actions

You can find the KeyboardActions class inside src/test/java/actionTests. There you can see all the possible Actions methods are given.

Mouse Actions

You can find the MouseActions class inside src/test/java/actionTests. There you can see all the possible Actions methods are given.

Run the Test Case -

  • Right click on any java file inside src/test/java/actionTests and select - Run '<FILE_NAME>'

Read the complete Blog - How to use Actions Class in Selenium

Happy Testing!!!


Read More Articles

Testing Blog

Follow us on Social Media Accounts

LinkedIn Instagram Facebook

About

Selenium actions class with examples.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages