Issue with Multiple file upload using sendkeys

1,265 views
Skip to first unread message

reachout

unread,
Apr 2, 2014, 7:16:38 PM4/2/14
to seleniu...@googlegroups.com
I am trying to upload multiple files with sendkeys

String filepath = /src/test/resources/testfiles/

        driver.findElement(By.name("zipFile")).sendKeys(
                new java.io.File(".").getCanonicalPath() + filepath + fileName1,
                new java.io.File(".").getCanonicalPath() + filepath + fileName2);


But I get just one file uploaded at time, does sendkeys support multiple file upload?

HTML Element:
<span id="upload-multi-span" class="btn btn-default fileinput-button">
           <span>Select Files</span> 
           <input type="file" multiple="" name="zipFile" class="input-lg" id="zipFile">
         </span>

Help pls

murali

unread,
Apr 3, 2014, 8:31:28 AM4/3/14
to seleniu...@googlegroups.com
Wow...

It looks like interesting... generally i will send keyevents to select multiple elements in web app. But it related to file uploading.. i am thinking that we can upload only one file at a time but i am not sure... i have to try this one.

Thanks,
Murali
Selenium Trainer

Panikera Raj

unread,
Apr 3, 2014, 12:24:27 PM4/3/14
to selenium-users
Hi Aarthy

       Does it supports to upload multiple files manually at a time, Little bit interesting if it does

Regards,
Panikera




--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b95ed96f-853a-447a-9fe1-9530836185a4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reachout

unread,
Apr 3, 2014, 2:10:22 PM4/3/14
to seleniu...@googlegroups.com
It works manually when I tried to upload

On Thursday, April 3, 2014 12:24:27 PM UTC-4, Panikera Raj wrote:
Hi

Regards,
Panikera


David

unread,
Apr 3, 2014, 5:16:21 PM4/3/14
to seleniu...@googlegroups.com
Real "multiple" file upload (particularly HTML5-based) is not supported in Selenium yet. Additionally, in terms of support, there is no "definition" or syntax defined yet on how you would "sendKeys" the multiple files.

On an uploader that supports multiple files, you can only upload a single file at a time with Selenium even though you can manually browse & select multiple.

Phanindra Chowdary Chunduri

unread,
Apr 4, 2014, 6:11:44 AM4/4/14
to seleniu...@googlegroups.com


String filesToUploadPath = "\""+new java.io.File(".").
getCanonicalPath() + filepath + fileName1+"\",\""+new java.io.File(".").getCanonicalPath() + filepath + fileName2+"\"";

driver.findElement(By.name("zipFile")).sendKeys(filesToUploadPath);



On Thursday, April 3, 2014 4:46:38 AM UTC+5:30, reachout wrote:
I am trying to upload multiple files with sendkeys

String filepath = /src/test/resources/testfiles/

       


Reply all
Reply to author
Forward
0 new messages