elixir-wallaby / wallaby

Concurrent browser tests for your Elixir web apps.
https://twitter.com/elixir_wallaby
MIT License
1.67k stars 198 forks source link

multiple file upload #566

Open cysiegel opened 4 years ago

cysiegel commented 4 years ago

Thank you again for this great library

Currently the attach_file/3 only allows the uploading of one file at a time
Is it possible to add the ability to upload multiple files at once

Thanks

michallepicki commented 4 years ago

Hi! Which backend (chromedriver, selenium) are you using? And if you're using selenium, which browser?

Based on this stackoverflow question, and current wallaby attach_file/3 implementation, I think you might be able to attach multiple files this way for Chrome:

session
|> set_value(file_input_query, Enum.join([absolute_path1, absolute_path2], " \n "))
alexandreguz commented 4 years ago

There is actually a bug in the attach_file function. The function receives a list of tuples with the path of the files to be uploaded. However, it is not possible to send a list with more than one item.

image

The michallepicki solution works.

Thanks