Skip to main content
Latest
class FileChooser
Re-export
import { FileChooser } from "https://deno.land/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/types.js";

File choosers let you react to the page requesting for a file.

Examples

Example 1

const [fileChooser] = await Promise.all([
  page.waitForFileChooser(),
  page.click('#upload-file-button'), // some button that triggers file selection
]);
await fileChooser.accept(['/tmp/myfile.pdf']);

Constructors

new
FileChooser(element: ElementHandle<any>, event: Protocol.Page.FileChooserOpenedEvent)

Methods

accept(filePaths: string[]): Promise<void>

Accept the file chooser request with given paths.

cancel(): void

Closes the file chooser without selecting any files.

isMultiple(): boolean

Whether file chooser allow for multiple file selection.