I am automating a UI test where selecting file to upload is involved, I was able to automate the file selection using this solution.
WebElement filepath=driver.findElement(By.id("fileUploadId"));
filepath.sendKeys("C:\\TextFile.txt");
My issue is that I need to select many files to upload, is there a special format I should follow in the path I am sending? because I tried space-separated paths and it didn't work.
To upload multiple files you can construct the character string adding all the absolute path of the files seperated by \n
as follows:
WebElement filepath = driver.findElement(By.id("fileUploadId"));
filepath.sendKeys("C:/TextFile1.txt \n C:/TextFile2.txt \n C:/TextFile3.txt");
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加