标签:style blog color os java ar 文件 div cti
public void uploadFile(String path) { //File file = new File("C:\\jacob-1.18-M2-x64.dll"); // System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());//把DLL加入到系统变量.或者丢到System32下 AutoItX x = new AutoItX(); Locale locale = Locale.getDefault(); String title = "Open"; String browserType = TestCase.DriverManager.browserType; if (browserType.equals("CHROME")) { if (locale.getDisplayLanguage().equals("中文")) title = "打开"; if (x.winWaitActive(title, "", 10)) { if (x.winExists(title)) { x.sleep(500); //x.send(path); x.controlCommandEditPaste(title, "", "Edit1", path); x.controlClick(title, "", "Button1"); } } } if (browserType.equals("FIREFOX")) { title = "File Upload"; if (locale.getDisplayLanguage().equals("中文")) title = "文件上传"; if (x.winWaitActive(title, "", 10)) { if (x.winExists(title)) { x.sleep(500); //x.send(path); x.controlCommandEditPaste(title, "", "Edit1", path); x.controlClick(title, "", "Button1"); } } } if (browserType.equals("IE")) { title = "Choose File to Upload"; if (locale.getDisplayLanguage().equals("中文")) title = "选择要加载的文件"; if (x.winWaitActive(title, "", 10)) { if (x.winExists(title)) { x.sleep(500); //x.send(path); x.controlCommandEditPaste(title, "", "Edit1", path); x.controlClick(title, "", "Button1"); } } } }
标签:style blog color os java ar 文件 div cti
原文地址:http://www.cnblogs.com/zhangminjie/p/3959756.html