如何使用Appium读取Android设备的excel文件下载文件夹?
在获取Android设备的下载文件夹的路径时遇到问题。
String downloadPath = BaseTest.getPath() + "/Exported file folder";
System.out.println(downloadPath);
String filepath = Utilities.getLatestFilefromDir(downloadPath).getAbsolutePath();
//String filepath = Environment.getExternalStorageDirectory().getAbsolutePath();
String path = filepath.replaceAll("\\\\+", "/");
System.out.println(path);
ArrayList<String> rown = new ArrayList<String>();
try {
File file = new File(filepath);
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheet(sheetname);
Row row = sheet.getRow(rownum);
int totalColumns = row.getLastCellNum();
for (int y = 2; y < totalColumns; y++) {
rown.add(row.getCell(y).getStringCellValue());
}
workbook.close();
} catch (Exception e) {
System.out.println(e);
}
return rown;