我是 JWinAuto 和 AutoIT 的新手。我想单击文件下载控件上的保存按钮。我可以将焦点放在按钮上,但如果当前文件下载不在焦点上,它不会单击。我已将其设置为顶部并激活它以使其集中。但我仍然无法点击按钮。我在这里附上代码。任何人都可以告诉我是否遗漏了什么..
private static final WString BLANK_STRING = new WString("");
private static final WString FILE_DOWNLOAD = new WString("File Download");
System.out.println("hi..");
JAutoITx wrapper = JAutoITx.INSTANCE;
wrapper.AU3_Init();
wrapper.AU3_WinWait(FILE_DOWNLOAD, BLANK_STRING, 15);
wrapper.AU3_WinActivate(FILE_DOWNLOAD, BLANK_STRING);
System.out.println(wrapper.AU3_WinActive(FILE_DOWNLOAD, BLANK_STRING));
wrapper.AU3_WinSetOnTop(FILE_DOWNLOAD, BLANK_STRING, 0);
wrapper.AU3_ControlFocus(FILE_DOWNLOAD, BLANK_STRING, new WString(
"[CLASS:Button; INSTANCE:2]"));
wrapper.AU3_ControlClick(FILE_DOWNLOAD, BLANK_STRING, new WString(
"[CLASS:Button; INSTANCE:2]"), BLANK_STRING, 1, 6660, 500);
wrapper.AU3_Send(new WString("s"), 0);