Modifications in Action class

Action class is also available in Selenium 3. In Selenium 4, Modifications in Action class took place. Action class is generally used to simulate input actions from mouse and keyboard on specific web element like left key, right key, double click etc.

In selenium 4, several methods are added to the Action class with some modifications. Below are list of some methods in Action class in selenium 4.

Modifications in Action class
  • Click(WebElement) : This method is added to the Action class to replace the MoveToElement(onElement).click(). It generally performs the click on the certain element. So that element we need to pass as argument to this method.
  • clickAndHold(WebElement) : This method is added to the Action class to replace the MoveToElement(onElement).clickAndHold(). It generally performs the click and hold without release on the certain element. So that element we need to pass as argument to this method.
  • contextClick(WebElement): This method is added to the Action class to replace the MoveToElement(onElement).contextClick(). It generally performs the click and hold without release on the certain element. So that element we need to pass as argument to this method.
  • doubleClick(WebElement): This method is added to the Action class to replace the MoveToElement(onElement).doubleClick(). It generally performs the click and hold without release on the certain element. So that element we need tp pass as argument to this method.
  • release(): This method is added for releasing the pressed mouse button. It was initially part of org.openqa.selenium.interactions.buttonReleaseAction class. Now it has been moved to Action class.

Action class in selenium provides several methods for performing a single action or a series of Actions on the WebElements present in the DOM.

Mouse action and keyword action are the two broad category of Actions.  

Leave a Reply

Your email address will not be published. Required fields are marked *