Selenium WebDriver: Upload multiple files

As far as I know, selenium still does not support multiple file upload (see issue on google code).

There is at least one workaround: apparently create a form that contains as many input fields as you need (see another stackoverflow question). Not the best solution, as it (probably) requires altering your code for selenium to work.

However, as you have found out (thanks for this!), it does seem possible to trigger multiple file uploads in chrome and (although I did not test it) IE as well.

I just confirmed that the chrome “\n” trick works both locally and on Browserstack (I used the default images they provide), which, considering the state of things, is good enough for me.

I hope this helps.

Leave a Comment

tech