我目前正在测试脚本,需要上传到文件并检查文件上传是否成功。我能够成功上传第一个文件,因为它是一个非常小的文件(7KB)。尝试上传大文件时的网络驱动程序超时
但是,当我尝试上传第二个相对较大(8 MB)的文件作为测试环境时。该守则超时而不继续下一步。
我试着用这无助于解决问题
WebElement filePath2 = driver.findElement(By.xpath(".//*[@id='wrapper']/table[2]/tbody/tr[1]/td/table/tbody/ tr[4]/td[2]/form/input[6]"));
filePath2.sendKeys("\\\\this\\is\\a\\sample\\file\\path\\SAMPLEFILE_LARGE.txt");
driver.findElement(By.xpath(".//*[@id='wrapper']/table[2]/tbody/tr[1]/td/table/tbody/tr[4]/td[2]/form/input[7]")).click();
//Used below waits separaytly, but did not work out
//Thread.sleep(300000);
WebDriverWait wait1 = new WebDriverWait(driver,300);
boolean upload = driver.getPageSource().contains("SAMPLE FILE LARGE");
if (upload == true){
System.out.println("Large file uploaded successfully");
}
else{
System.out.println("Large file DID NOT upload successfully, Exiting automation now.");
}
文件上传后会发生什么,不文件名出现在任何地方,或者文件上传成功的任何其他指示? – smit9234
如果您手动上传大文件,需要多长时间? –
你得到的错误/异常是什么? –