Skip to main content

FileChooser

FileChooser objects are dispatched by the page in the Page.onFileChooser(handler) event.

FileChooser fileChooser = page.waitForFileChooser(() -> page.getByText("Upload file").click());
fileChooser.setFiles(Paths.get("myfile.pdf"));

方法 (Methods)

element

Added before v1.9 fileChooser.element

Returns input element associated with this file chooser.

使用方式

FileChooser.element();

傳回值


isMultiple

Added before v1.9 fileChooser.isMultiple

Returns whether this file chooser accepts multiple files.

使用方式

FileChooser.isMultiple();

傳回值


page

Added before v1.9 fileChooser.page

Returns page this file chooser belongs to.

使用方式

FileChooser.page();

傳回值


setFiles

Added before v1.9 fileChooser.setFiles

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.

使用方式

FileChooser.setFiles(files);
FileChooser.setFiles(files, options);

參數

  • files Path | Path[] | FilePayload | FilePayload[]#
  • options FileChooser.SetFilesOptions (optional)

傳回值