Selenium test file upload #1140

Closed
opened 2020-02-03 16:06:03 +00:00 by Tzeny · 1 comment
Tzeny commented 2020-02-03 16:06:03 +00:00 (Migrated from github.com)

Hello,

I have built a project which uses your library, and I am trying to run frontend integration tests on it using Selenium in Python. The problem is that I am not sure how I can automate the file upload process for your library?

Could you please offer any advice on where I should start? I have seen that for a normal form, I should manually fill in the path to the local files, but it is unclear how I should do this for ng2-file-upload.

Thank you so much for your time!

Hello, I have built a project which uses your library, and I am trying to run frontend integration tests on it using Selenium in Python. The problem is that I am not sure how I can automate the file upload process for your library? Could you please offer any advice on where I should start? I have seen that for a normal form, I should manually fill in the path to the local files, but it is unclear how I should do this for ng2-file-upload. Thank you so much for your time!
Tzeny commented 2020-02-04 07:49:40 +00:00 (Migrated from github.com)

I realized that the upload element has an input with type file. Here is how I accessed it:

file_input = find_element_by_css_selector(driver, "#upload_component > div.justify-content-md-center.resizeUpload > div > div > input[type=file]")

file_input.send_keys('/path/to/file.png)
I realized that the upload element has an input with type file. Here is how I accessed it: ``` file_input = find_element_by_css_selector(driver, "#upload_component > div.justify-content-md-center.resizeUpload > div > div > input[type=file]") file_input.send_keys('/path/to/file.png) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#1140