I'm trying to achieve the following : I have the following url : https://img.pokemondb.net/sprites/sword-shield/icon/bulbasaur.png I need to press ctrl + s via Selenium to open the download Windows window and then press enter in order to save the image.
This is my code :
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
Robot robot = new Robot();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
String url = "https://img.pokemondb.net/sprites/sword-shield/icon/bulbasaur.png";
driver.get(url);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_S);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
When I execute this , it works everything EXCEPT the PRESS ENTER , the test open the save as window but remain there , without any exception , it just cannot press ENTER key .
Any help ?