Skip to main content

FileChooser

FileChooser objects are dispatched by the page in the Page.FileChooser event.

var fileChooser = await page.RunAndWaitForFileChooserAsync(async () =>
{
await page.GetByText("Upload file").ClickAsync();
});
await fileChooser.SetFilesAsync("temp.txt");

方法 (Methods)

Element

Added before v1.9 fileChooser.Element

Returns input element associated with this file chooser.

使用方式

FileChooser.Element

傳回值


IsMultiple

Added before v1.9 fileChooser.IsMultiple

Returns whether this file chooser accepts multiple files.

使用方式

FileChooser.IsMultiple

傳回值


Page

Added before v1.9 fileChooser.Page

Returns page this file chooser belongs to.

使用方式

FileChooser.Page

傳回值


SetFilesAsync

Added before v1.9 fileChooser.SetFilesAsync

Sets the value of the file input this chooser is associated with. If some of the filePaths are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files.

使用方式

await FileChooser.SetFilesAsync(files, options);

參數

傳回值