how to perform right click operation in selenium code example

Example 1: right click on selenium

I would create an action class in order to right click or double click
To perform any actions against web element using actions class,
we need to locate the element first:

WebElement el = driver.findElement

Double Click (doubleClick):
	    Actions actions = new Actions (driver).perform 				 		
        actions.doubleClick(el).perform()
		actions.moveTo(el).perform actions.doubleClick.perform 			
        actions.moveTo(el).doubleClick().build.perform()
Right Click (contextClick):
	actions.contextClick(elementLocator).perform();

Example 2: right click on selenium

I would create an action class in order to right click or double click
To perform any actions against web element using actions class,
we need to locate the element first:

WebElement el = driver.findElement

Double Click (doubleClick):
	    Actions actions = new Actions (driver).perform 				 		
        actions.doubleClick(el).perform()
		actions.moveTo(el).perform actions.doubleClick.perform 			
        actions.moveTo(el).doubleClick().build.perform()
Right Click (contextClick):
	actions.contextClick(elementLocator).perform();

Tags:

Misc Example