Discussion:
[selenium-users] Unable to upload multiple files using sendKeys()
Sindhu
2017-07-24 21:25:16 UTC
Permalink
*Hi everyone,*

*I am having issue with trying to upload(attach technically) multiple files
at once using sendKeys().*

Browser:* IE11*
Webdriver version*: 2.42.2*

*sendKeys() snippet:*

String pathList = ""C:\\path\\to\\file1" "C:\\path\\to\\file2"
"C:\\path\\to\\file3"";
sendKeys(pathList);

*My file input element is inside a button and it looks like this: *

<div class="button button-select fileinput-button">
Select files from your computer
<input type="file" name="files[]" multiple="">
</div>

*Since it is inside a button** (and looks like hidden)**, sendKeys() is
unable to access the input element.*


*So far I have tried the following solutions:*

*1. Using Javascript to make the input element visible:*
document.getElementsByName('files[]')[0].style.visibility='visible';
document.getElementsByName('files[]')[0].style.display='block';
document.getElementsByName('files[]')[0].style.display='inline';
document.getElementsByName('files[]')[0].style.display=\"block\";

None of the above statements seems to be making the input element visible.

*2. Using Javascript to change the HTML and bring the input element out of
the button:*

This approach is changing the HTML and bringing the input element out of
the button which I can see visibly. And sendKeys() is able to access the
input element and populate the file path input, BUT the files are not
actually getting attached. I manually tried this work around and files get
attached in Chrome and doesn't in IE11. IE11 is the official browser for
our application, so I am looking for solutions to make this work in IE11.

*3. Using webdriver version 2.39.0:*

In this version sendKeys() is able to access the invisble input element.
But, I don't want to use older version.

*Could some PLEASE suggest any solution that would help me. Thanks in
advance!! *
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2d5ca889-bc1a-4b93-86ad-adbdf8bb538a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jim Evans
2017-07-25 11:43:55 UTC
Permalink
Try 2.46 of the IE driver or higher. It might not make a difference, but there were some changes related to file uploads and "transparent" <input> elements in that release.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bdd9804d-27fe-407e-a0a5-98e554e67a6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sindhu
2017-07-25 14:37:04 UTC
Permalink
Thank you so much for pointing in the right direction :) Updating web
driver version to latest fixed the issue partially.

Currently sendKeys() is able to access the input element, But throws an
error saying the file path couldn't be found. I am passing a string that
has concatenated file paths which looks like this: '"C:\path\to\file1"
"C:\path\to\file2" "C:\path\to\file3"'

*Error message:*
org.openqa.selenium.WebDriverException: Attempting to upload file '"C:\path\to\file1"
"C:\path\to\file2" "C:\path\to\file3"' which does not exist.
Post by Jim Evans
Try 2.46 of the IE driver or higher. It might not make a difference, but
there were some changes related to file uploads and "transparent" <input>
elements in that release.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a97e6b23-8b24-4cc1-b35e-444da0fb93fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
vinod kalghatgi
2018-11-22 16:31:17 UTC
Permalink
Hello,
Even I am also facing same issue. I am able to upload multiple files in
Chrome but in IE webdriver 3.14.0, I am getting error. Is there any way we
can upload multiple files in IE Edge browser?

Please guide.

Regards,
Vinod
Post by Sindhu
Thank you so much for pointing in the right direction :) Updating web
driver version to latest fixed the issue partially.
Currently sendKeys() is able to access the input element, But throws an
error saying the file path couldn't be found. I am passing a string that
has concatenated file paths which looks like this: '"C:\path\to\file1"
"C:\path\to\file2" "C:\path\to\file3"'
*Error message:*
org.openqa.selenium.WebDriverException: Attempting to upload file '"C:\path\to\file1"
"C:\path\to\file2" "C:\path\to\file3"' which does not exist.
Post by Jim Evans
Try 2.46 of the IE driver or higher. It might not make a difference, but
there were some changes related to file uploads and "transparent" <input>
elements in that release.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b4b5808e-c014-4c3d-85c1-97ad98691d8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...