0

Here the snapshot the ie download explorer

I have tried using robot but not working.

try
 {
      Robot robot = new Robot();
      robot.setAutoDelay(250);
      robot.keyPress(KeyEvent.VK_ALT);
      Thread.sleep(1000);
      robot.keyPress(KeyEvent.VK_S);
      robot.keyRelease(KeyEvent.VK_ALT);
      robot.keyRelease(KeyEvent.VK_F4);
 }
 catch (AWTException e)
 {
     e.printStackTrace();
 }

I have tried using System.out.println to check if the code navigates to the robot function. But the screen seems to be stuck after the line that prompting that download.

Is the current window not active ? Because if i try to click any element without saving the file it is not able to click.

Code to download is an icon

 driver.findElement(By.xpath("//input[@name='ctl00$TrackerPlaceHolder$btnexcel']")).click();
  • Hello, please visit my previous answer in this manner: https://stackoverflow.com/a/52653251/10413416 – Infern0 Dec 19 '18 at 08:32
  • Auto It exe file is executing if i run the .exe manually . But if i put the code to run the .exe file from selenium , it is not working. try { System.out.println("Try to run .exe"); Runtime.getRuntime().exec("C:\\save_file_IE11.exe"); System.out.println("Inside try"); } catch (IOException e) { System.out.println("Inside Catch"); e.printStackTrace(); } – Raishul Alam Dec 21 '18 at 05:59

1 Answers1

0

You have to use CTRL+S keystroke instead of ALT+S.

Xing-fu
  • 38
  • 9