如何在 LeanFT 工具中使用 Java 单击句柄 Chrome 的 "save as" 对话框?
How to click on handle Chrome's "save as" dialog using Java in LeanFT Tool?
使用LeanFT的Java SDK,是否可以对Chrome's "Save As" dialog中的"Save"按钮进行点击操作?
您是否尝试过使用 Object Identification Tool 来识别 保存 按钮?
无论如何,我了解到您现在正在使用 Web 技术,然后您单击“保存”按钮,然后它会提示您将文件保存在某个位置。
你有两个选择:
设置Chrome不再询问保存文件的位置;
使用 STD 技术描述您要单击的保存按钮。
此类描述的示例:
Desktop.describe(Window.class, new WindowDescription.Builder()
.ownedWindow(false)
.childWindow(false)
.windowClassRegExp("Chrome_WidgetWin_1")
.windowTitleRegExp(" Google Chrome").build())
.describe(Dialog.class, new DialogDescription.Builder()
.ownedWindow(true)
.childWindow(false)
.text("Save As")
.nativeClass("#32770").build())
.describe(Button.class, new ButtonDescription.Builder()
.text("&Save")
.nativeClass("Button").build());
然后你可以在这个对象上调用.click
方法(或者取消,等等)。
String home = System.getenv("USERPROFILE") + "\Downloads\";
String fileName = "xxxxxxxxx.xls";
File file = new File(home + fileName);
if (file.exists()) {
file.delete();
System.out.println("Deleted existing CurrentSortRules.xls file if it is already present");
}
Window popup = Desktop.describe(Window.class, new WindowDescription.Builder().ownedWindow(false).childWindow(false)
.windowClassRegExp("Chrome_WidgetWin_1").windowTitleRegExp(" Google Chrome").build())
.describe(Dialog.class, new DialogDescription.Builder().ownedWindow(true).childWindow(false)
.text("Save As").nativeClass("#32770").build());
使用LeanFT的Java SDK,是否可以对Chrome's "Save As" dialog中的"Save"按钮进行点击操作?
您是否尝试过使用 Object Identification Tool 来识别 保存 按钮?
无论如何,我了解到您现在正在使用 Web 技术,然后您单击“保存”按钮,然后它会提示您将文件保存在某个位置。
你有两个选择:
设置Chrome不再询问保存文件的位置;
使用 STD 技术描述您要单击的保存按钮。
此类描述的示例:
Desktop.describe(Window.class, new WindowDescription.Builder()
.ownedWindow(false)
.childWindow(false)
.windowClassRegExp("Chrome_WidgetWin_1")
.windowTitleRegExp(" Google Chrome").build())
.describe(Dialog.class, new DialogDescription.Builder()
.ownedWindow(true)
.childWindow(false)
.text("Save As")
.nativeClass("#32770").build())
.describe(Button.class, new ButtonDescription.Builder()
.text("&Save")
.nativeClass("Button").build());
然后你可以在这个对象上调用.click
方法(或者取消,等等)。
String home = System.getenv("USERPROFILE") + "\Downloads\";
String fileName = "xxxxxxxxx.xls";
File file = new File(home + fileName);
if (file.exists()) {
file.delete();
System.out.println("Deleted existing CurrentSortRules.xls file if it is already present");
}
Window popup = Desktop.describe(Window.class, new WindowDescription.Builder().ownedWindow(false).childWindow(false)
.windowClassRegExp("Chrome_WidgetWin_1").windowTitleRegExp(" Google Chrome").build())
.describe(Dialog.class, new DialogDescription.Builder().ownedWindow(true).childWindow(false)
.text("Save As").nativeClass("#32770").build());