Fix basic file upload functionality -> ElementHandle#set_input_files #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
Changes made to address this issue #24
I also ran into a second issue half way through. The video file I was trying to upload would only partially upload and then stop.
How?
I fixed the first issue by modifying the File struct in utils.rs to call
mime
mimeType
which, although breaking Rust naming conventions, ensures the driver is receiving the attribute name in the form it expects.After fixing that, I found the upload was still not working correctly unto completion (specifically trying a file upload on Bitchute). To fix this issue I updated the playwright driver version. Current version is 1.11.0, which was upgraded to 1.12.2 to solve that issue. Trying to upgrade to higher versions (I tried 1.16 and 1.19) breaks the code because no "objects" are returned to the Context struct from the driver process stdout.
Tests
No tests were added and I did not fix the file_chooser test.
Before you test out the code yourself it is important to to delete the previous driver folder which is located at
~/.cache/ms-playwright/playwright-rust/driver
, at least on Linux machines.