Interface IFileChooser
- Namespace
- Microsoft.Playwright
- Assembly
- Microsoft.Playwright.dll
IFileChooser objects are dispatched by the page in the FileChooser event.
var fileChooser = await page.RunAndWaitForFileChooserAsync(async () =>
{
await page.GetByText("Upload file").ClickAsync();
});
await fileChooser.SetFilesAsync("temp.txt");
public interface IFileChooser
Properties
Element
Returns input element associated with this file chooser.
IElementHandle Element { get; }
Property Value
IsMultiple
Returns whether this file chooser accepts multiple files.
bool IsMultiple { get; }
Property Value
Page
Returns page this file chooser belongs to.
IPage Page { get; }
Property Value
Methods
SetFilesAsync(FilePayload, FileChooserSetFilesOptions?)
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.
Task SetFilesAsync(FilePayload files, FileChooserSetFilesOptions? options = null)
Parameters
files
FilePayloadoptions
FileChooserSetFilesOptionsCall options
Returns
SetFilesAsync(IEnumerable<FilePayload>, FileChooserSetFilesOptions?)
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.
Task SetFilesAsync(IEnumerable<FilePayload> files, FileChooserSetFilesOptions? options = null)
Parameters
files
IEnumerable<FilePayload>options
FileChooserSetFilesOptionsCall options
Returns
SetFilesAsync(IEnumerable<string>, FileChooserSetFilesOptions?)
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.
Task SetFilesAsync(IEnumerable<string> files, FileChooserSetFilesOptions? options = null)
Parameters
files
IEnumerable<string>options
FileChooserSetFilesOptionsCall options
Returns
SetFilesAsync(string, FileChooserSetFilesOptions?)
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.
Task SetFilesAsync(string files, FileChooserSetFilesOptions? options = null)
Parameters
files
stringoptions
FileChooserSetFilesOptionsCall options