First download autoit: https://www.autoitscript.com/site/autoit/
Add it to path inside windows env variables so it can be executable from command prompt.
Example Path:
C:\Program Files (x86)\AutoIt3
Here is an example method that handles auto it scripts.
public static void saveFileInternetExplorer() throws Exception {
String pathToAutoItScript = "C:\\save_file_IE11.au3";
String command = "AutoIt3.exe " + pathToAutoItScript;
System.out.println("AutoIt command: " + command );
String output = new CommandLine(command).executeGetOutput();
if (output.contains("ERROR")) {
throw new Exception("AutoIt script error: " + output);
}
System.out.println(output);
}
AutoIt script to save file in IE 11
Sleep(5000)
Local $hIE = WinGetHandle("[Class:IEFrame]")
Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]")
If WinExists($hIE,"") Then
WinActivate($hIE,"")
ControlSend($hIE ,"",$hCtrl,"{F6}") ; Gives focus to Open Button
Sleep(500)
ControlSend($hIE ,"",$hCtrl,"{TAB}") ; Gives focus to Save Button
Sleep(500)
ControlSend($hIE ,"",$hCtrl,"{enter}") ; Submit whatever control has focus
EndIf
Sleep(3000)
After clicking on the download button, run the autoit3 script this should save the file.
Good luck!