In a folder 5 CSV files and i need to upload one by one for validation purpose but even single file is not uploading i tried so many methods,can anyone suggest any methods, i'm doing in salesforce.
WebElement uploadElement = driver.findElement(By.xpath("//div[@class='cBatchMaster']//input[1]"));
uploadElement.sendKeys("E:\\Automation\\Error Inventory.csv");
above the code is for single file and directly i'm giving the exact file location but i want to upload the files in one folder
Thanks
Below is the solution in C#. A similar approach can be used in Java
Use AutoITX to upload files. You would need to add AutoItX.Dotnet in your nuget package
using AutoIt;
public static void UploadDocument(IWebElement uploadElement, string path)
{
uploadElement.Click();
AutoItX.WinActivate("Open");
string filepath = Path.Combine(System.IO.Path.GetFullPath(@"..\..\"),path);
Thread.Sleep(1000);
AutoItX.Send(filepath);
AutoItX.Send("{ENTER}");
}
You should be able to upload multiple files from AutoIT once you are able to upload the single file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.