1.利用AutoIT 2.模拟键盘直接复制上传文件路径 多个文档路径可以用空格和双引号分割 public void windowsCtrlCV(TestStep step) throws Exception { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("C:\\Users\\Desktop\\TestData3.pdf"),null); Thread.sleep(2000); try { if (Constants.ISDEBUG) System.out.println("『正常测试』开始执行: " + "<" + step.getDesc() + ">"); Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL); robot.keyRelease(KeyEvent.VK_V); Thread.sleep(2000); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); } catch (Exception e) { e.printStackTrace(); if (Constants.ISDEBUG) System.err.println(Constants.LogCustom+"windowsCtrlCV"); } }
3. xpath是input