Первая загрузка autoit: https://www.autoitscript.com/site/autoit/ Добавьте его в путь в переменных Windows env, чтобы его можно было выполнить из командной строки.
Пример пути:
C:\ Program Files (x86) \ AutoIt3
Вот пример метода, который обрабатывает сценарии auto it.
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 для сохранения файла в 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)
После нажатия на кнопку загрузки запустите скрипт autoit3, который должен сохранить файл.
Удачи!