Steps:
1. Find element/location where you need to right click
2. Create action and do context-click
3. Trigger keyboard event using Robot to select the menu option and enter
Code:
WebElement ele = driver.findElement(By.xpath(xpathExpression));
Actions act = new Actions(driver);
act.moveToElement(ele).contextClick();
act.build().perform();
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyPress(KeyEvent.VK_ENTER);
** Like if This helps ..
1. Find element/location where you need to right click
2. Create action and do context-click
3. Trigger keyboard event using Robot to select the menu option and enter
Code:
WebElement ele = driver.findElement(By.xpath(xpathExpression));
Actions act = new Actions(driver);
act.moveToElement(ele).contextClick();
act.build().perform();
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyPress(KeyEvent.VK_ENTER);
** Like if This helps ..
Comments
Post a Comment