playwright/imp/
file_hooser.rs

1use crate::imp::{
2    core::*, element_handle::ElementHandle as ElementHandleImpl, page::Page as PageImpl, prelude::*
3};
4
5/// `FileChooser` objects are dispatched by the page in the [page::Event::FileChooser](crate::api::page::Event::FileChooser) event.
6///
7/// ```js
8/// const [fileChooser] = await Promise.all([
9///  page.waitForEvent('filechooser'),
10///  page.click('upload')
11/// ]);
12/// await fileChooser.setFiles('myfile.pdf');
13/// ```
14#[derive(Debug, Clone)]
15pub struct FileChooser {
16    pub(crate) page: Weak<PageImpl>,
17    pub(crate) element_handle: Weak<ElementHandleImpl>,
18    pub(crate) is_multiple: bool
19}
20
21impl FileChooser {
22    pub(crate) fn new(
23        page: Weak<PageImpl>,
24        element_handle: Weak<ElementHandleImpl>,
25        is_multiple: bool
26    ) -> Self {
27        Self {
28            page,
29            element_handle,
30            is_multiple
31        }
32    }
33}