pub struct FileChooser { /* private fields */ }Expand description
A file-chooser dialog opened by the page.
Produced by Page::on_filechooser. Call
set_files to accept the chooser with the given
server-side file path(s).
Implementations§
Source§impl FileChooser
impl FileChooser
Sourcepub fn is_multiple(&self) -> bool
pub fn is_multiple(&self) -> bool
true if the chooser allows selecting multiple files (selectMultiple).
Sourcepub async fn element(&self) -> Result<Option<ElementHandle>>
pub async fn element(&self) -> Result<Option<ElementHandle>>
The <input type=file> element that triggered the chooser, if any.
Resolves the CDP backendNodeId from the event to a remote object id via
DOM.resolveNode, then wraps it in an ElementHandle. Returns None
if the event carried no backendNodeId (no backing element).
Sourcepub async fn set_files(&self, files: &[impl AsRef<Path>]) -> Result<()>
pub async fn set_files(&self, files: &[impl AsRef<Path>]) -> Result<()>
Accept the chooser, uploading the given server-side file path(s).
files are absolute filesystem paths Chrome can read directly (not file
contents). Sets the files on the chooser’s <input type=file> (resolved
from the event’s backendNodeId) via DOM.setFileInputFiles, which is
supported across Chrome versions.
Trait Implementations§
Source§impl Clone for FileChooser
impl Clone for FileChooser
Source§fn clone(&self) -> FileChooser
fn clone(&self) -> FileChooser
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more