Actions class in Selenium is primarily used to simulate input actions from mouse and keyboard on specific web elements (For eg: Left click, Right click, Double click, etc)
In Selenium 4, several new methods have been added to the Actions class:
click(WebElement)
: This method is added to Actions class to replace the moveToElement(onElement).click()
. It is used to click on a certain web element.
clickAndHold(WebElement)
: This method will replace the moveToElement(onElement).clickAndHold()
. It is used to click on an element without releasing the click.
contextClick(WebElement)
: This method will replace moveToElement(onElement).contextClick()
. It will perform the right click operation.
doubleClick(WebElement)
: This method is added to replace moveToElement(element).doubleClick()
. It will perform a double click on an element.
release()
: This method (user for releasing the pressed mouse button) was initially a part of org.openqa.selenium.interactions.ButtonReleaseAction
class. Now with the updated version of Selenium, it has been moved to Actions class.