Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fresh/tests/deps.ts>Page#waitForFileChooser

The next-gen web framework.
Extremely Popular
Go to Latest
method Page.prototype.waitForFileChooser
Re-export
import { Page } from "https://deno.land/x/fresh@1.4.1/tests/deps.ts";
This method is typically coupled with an action that triggers file choosing.

::caution

This must be called before the file chooser is launched. It will not return a currently active file chooser.

::

Examples

The following example clicks a button that issues a file chooser and then responds with /tmp/myfile.pdf as if a user has selected this file.

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

Parameters

optional
options: WaitTimeoutOptions

Returns

Promise<FileChooser>