简体   繁体   中英

How to Upload multiple files for a web application in Selenium webdriver

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 ?

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!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM