I am trying to Save an image file using Actions and Robot class in selenium Java. I right click on the image through contextclick() and then use CTRL+v for the save As image option. However i am unable to access the window dialog box for Save As . I am also unable to debug as the debugging also does not take me to that line so that i can check the issue.
Below is the code:
WebElement imgRightClick=driver.findElement(By.xpath(".//table[contains(@id,'WebPart_twp285729713')]//img"));
Actions action= new Actions(driver);
action.contextClick(imgRightClick).sendKeys(Keys.CONTROL, "v").build().perform();
Thread.sleep(2000);
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_H);
Thread.sleep(2000);
robot.keyPress(KeyEvent.VK_COLON);
robot.keyRelease(KeyEvent.VK_COLON);
Thread.sleep(2000);
robot.keyPress(KeyEvent.VK_BACK_SLASH);
robot.keyRelease(KeyEvent.VK_BACK_SLASH);
Thread.sleep(2000);
robot.keyPress(KeyEvent.VK_ENTER);
Thread.sleep(3000L);
Please have a look into the above issue.