Skip to main content


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

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


Added in: v1.8

Returns input element associated with this file chooser.


Added in: v1.8

Returns whether this file chooser accepts multiple files.


Added in: v1.8

Returns page this file chooser belongs to.

FileChooser.SetFilesAsync(files, options)

Added in: v1.8
  • files <string|IEnumerable<string>|FilePayload|IEnumerable<FilePayload>>#
  • options <FileChooserSetFilesOptions?>
    • NoWaitAfter <bool?> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to false.#
    • Timeout <double?> Maximum time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout(timeout) or Page.SetDefaultTimeout(timeout) methods.#
  • returns: <void>#

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.