SevenC
0
Q:

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();

3
Actions action= new Actions(driver);
action.contextClick(productLink).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
1
from selenium import webdriver

from selenium.webdriver import ActionChains

import time

driver = webdriver.Chrome()

driver.get("https://swisnl.github.io/jQuery-contextMenu/demo.html")
button=driver.find_element_by_xpath("//body[@class='wy-body-for-nav']")

action=ActionChains(driver)
action.context_click(button).perform()
0

New to Communities?

Join the community