Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: files[0].mimeType: expected string, got undefined. Even though I'm supplying the mime type string. #24

Open
randall-coding opened this issue Feb 7, 2022 · 3 comments

Comments

@randall-coding
Copy link

I'm having this error while attempting to upload a file using set_input_files_builder(). I'm supplying a file and mime type but I'm receiving an error that files[0].mimeType is undefined, how could this be?

Here is the code in question:

let file:File = File::new("Test".to_string(), "video/mp4".to_string(), &std::fs::read("/home/super/Downloads/test.mp4").unwrap());
video_input.set_input_files_builder(file).set_input_files().await.unwrap();

I'm new to playwright and even when I use Selenium I haven't been uploading files. So I may be just being a newb here. Any help is greatly appreciated.

@litttley
Copy link

litttley commented Mar 1, 2022

I have the same problem, how to solve it

@randall-coding
Copy link
Author

randall-coding commented Mar 1, 2022

@littley It may be this feature is not yet implemented in playwright-rust. I say "may be" because I couldn't get any official word from the devs yet.

But when I look at the tests folder the only test commented out is the test involving file upload. The test is tests/page/mod.rs#file_chooser. I'm yet to actually run those tests to investigate further.

I am also planning on testing this by downloading playwright-java (or python) and testing the feature to make sure it works there and that this isn't a problem with my system.

@randall-coding
Copy link
Author

randall-coding commented Mar 17, 2022

@litttley
UPDATE: I've got something working and made a pull request for it here #26

To run it you'll first need to delete the previous downloaded driver at ~/.cache/ms-playwright/playwright-rust/driver.

Then you'll need to clone the pull request locally into your project folder and tell cargo to add it as a dependency

Here is what I added to my Cargo.toml file to do that:
playwright = { path = "./playwright-rust"} under [dependencies]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants