Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a html element

<input type=file multiple="">

How can I use send_keys to upload multiple files?

Currently this works with uploading single file. I want to use this to upload multiple files

I tried Comma separated paths but no luck.

share|improve this question

2 Answers 2

First, send all files to the element and then submit.

Following is Ruby code, but you can apply same logic for Python:

uploader = driver.find_element(id: 'file-upload')
uploader.send_keys 'path_to_file1'
uploader.send_keys 'path_to_file2'
uploader.send_keys 'path_to_file3'
.
.
.
uploader.submit

I'm not sure if this will work, but just give a try and let me know the result.

share|improve this answer

I tried this. uploader.send_keys 'path_to_file1'will upload file1 and when i try to upload file2,

exception is thrown saying "uploader" element cannot be interacted with

I did a uploader.is_enabled()

It gives me false

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.