-1

I have 4 images in a folder and need to upload all of them together into my application. I have done single file upload through selenium using sendKeys, but the multi file upload is a challenge!

Pr Sirisha
  • 9
  • 1
  • 2
  • Can you try this: https://stackoverflow.com/questions/37941694/how-to-upload-multiple-files-in-selenium – Al Imran May 23 '18 at 04:31
  • Possible duplicate of [How to upload Multiple files in selenium?](https://stackoverflow.com/questions/37941694/how-to-upload-multiple-files-in-selenium) – Nitishkumar Singh May 23 '18 at 04:42
  • Possible duplicate of [webdriver:upload multiple files](https://stackoverflow.com/questions/23955430/webdriverupload-multiple-files) – Alex Kulinkovich Aug 06 '19 at 12:12

1 Answers1

1
WebElement uploadElement = driver.findElement(By.xpath("   "));
//Single file upload
uploadElement.sendKeys("C:\\foldername\\abcd.png");

//Multi file upload - simultaneous
uploadElement.sendKeys("C:/foldername/firstImg.png \n C:/foldername/secondImg.png \n C:/foldername/thirdImg.png");

Note : \n needs to be preceeded with space

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Pr Sirisha
  • 9
  • 1
  • 2