FileChooser
Added in: v1.8FileChooser objects are dispatched by the page in the page.onFileChooser() event.
FileChooser fileChooser = page.waitForFileChooser(() -> page.getByText("Upload file").click());
fileChooser.setFiles(Paths.get("myfile.pdf"));Methods
fileChooser.element()
Added in: v1.8Returns input element associated with this file chooser.
Returns
ElementHandle
fileChooser.isMultiple()
Added in: v1.8Returns whether this file chooser accepts multiple files.
Returns
boolean
fileChooser.page()
Added in: v1.8Returns page this file chooser belongs to.
Returns
Page
fileChooser.setFiles()
Added in: v1.8Sets 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.
Arguments
filespath | Array<path> | Object | Array<Object>namestringFile name
mimeTypestringFile type
bufferBufferFile content
noWaitAfterboolean(optional)This option has no effect.
Maximum time in milliseconds. Defaults to
30000(30 seconds). Pass0to disable timeout. The default value can be changed by using thebrowserContext.setDefaultTimeout()orpage.setDefaultTimeout()methods.