playwright/api/
file_chooser.rs

1pub use crate::imp::file_hooser::FileChooser;
2use crate::{
3    api::{element_handle::SetInputFilesBuilder, ElementHandle, Page},
4    imp::utils::File
5};
6
7impl FileChooser {
8    /// Returns input element associated with this file chooser.
9    fn element(&self) -> ElementHandle { ElementHandle::new(self.element_handle.clone()) }
10    /// Returns whether this file chooser accepts multiple files.
11    fn is_multiple(&self) -> bool { self.is_multiple }
12    /// Returns page this file chooser belongs to.
13    fn page(&self) -> Page { Page::new(self.page.clone()) }
14
15    /// Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then
16    /// they are resolved relative to the the current working directory. For empty array, clears the selected files.
17    fn set_input_files_builder(&self, file: File) -> SetInputFilesBuilder {
18        SetInputFilesBuilder::new(self.element_handle.clone(), file)
19    }
20}