0

In my web application we use File upload button for uploading files. we use below command for uploading the file.

Code for upload:

Driver.findElement(By.xpath("//*[@id='fileupload']/div/div[1]/span[1]/input")).sendKeys("C:\\Users\\amarendra.singh\\Desktop\\Document\\2017\\Accession Images\\AR.jpg");

This command is used for uploading single file at once. To upload multiple file we use same command again and again with different filename.

We need to upload multiple file with the help of single command. Is there any way to upload multiple file with the help of single command ?

iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
  • Possible duplicate of [How to upload Multiple files in selenium?](https://stackoverflow.com/questions/37941694/how-to-upload-multiple-files-in-selenium) – iamsankalp89 Sep 17 '17 at 18:16

1 Answers1

0

You can upload mutiple files using AutoIT

In AutoIT , we can parameterized ControlSetText method

You can find how this works briefly describe here in this link

http://makeseleniumeasy.com/2017/02/27/upload-multiple-files-in-selenium/

Hope this helps!

  • Thanks for the quick reply. I tried with mentioned tool. However still i m not able to upload multiple file at once and complete path is not passing to popup folder "C:\Users\amarendra.singh\Desktop\Biocept Document\2011\Accession Images\Alk.jpg". Only Alk.jpg is passed in file location field. – Amarendra Singh Sep 18 '17 at 08:15
  • Code for upload file:- ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1","C:\Users\amarendra.singh\Desktop\Biocept Document\2011\Accession Images\Alk.jpg") ControlClick("Open","","Button1"). Please help me how can iparameterized ControlSetText method. – Amarendra Singh Sep 18 '17 at 08:23
  • Its working with this code, $vVariable = """C:\Users\amarendra.singh\Desktop\Biocept Document\2011\Accession Images\HER2.jpg""""C:\Users\amarendra.singh\Desktop\Biocept Document\2011\Accession Images\ALK.jpg""" ControlFocus("Open","","Edit1") ControlSetText("Open","","Edit1",$vVariable) ControlClick("Open","","Button1") – Amarendra Singh Sep 23 '17 at 18:47