Skip to main content


FileChooser objects are dispatched by the page in the page.on('filechooser') event.

// Note that Promise.all prevents a race condition
// between clicking and waiting for the file chooser.
const [fileChooser] = await Promise.all([
// It is important to call waitForEvent before click to set up waiting.
// Opens the file chooser.
await fileChooser.setFiles('myfile.pdf');


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.setFiles(files[, options])

Added in: v1.8

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.