Styrow.dev
Question 62 of 64

How to perform right click in selenium?

Question

How to perform right click in selenium?

Answer

Right click action in Selenium web driver can be done using Actions class. Actions class is a predefined class in Selenium web driver used to perform multiple keyboard and mouse operations such as Right Click, Drag and Drop, etc.

Actions actions = new Actions(driver);

WebElement elementLocator = driver.findElement(By.id(""ID""));

actions.contextClick(elementLocator).perform();