static void uploadFile(By by, String string1) {
boolean Location = false;
int sleep_total = 0;
while ((!Location) && (sleep_total <= max_sleep_total)) {
try {
WebElement fileInputBox = driver.findElement(by);
fileInputBox.sendKeys(string1);
Location = true;
System.out.println("上传成功:" + string1);
} catch (Exception e) {
System.out.println("上传失败" + string1);
sleep(2000);
sleep_total += 2;
System.out.println("总共已等待 " + sleep_total + " 秒");
}
}
if (!Location) {
RunExcelCase.judge = "fail";
System.out.println("最终上传失败" + string1);
snapshot("最终上传失败");
}
}