📄 playwright-python/python/docs/api/class-filechooser

File: class-filechooser.md | Updated: 11/18/2025

Source: https://playwright.dev/python/docs/api/class-filechooser

Skip to main content

On this page

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

  • Sync

  • Async

    with page.expect_file_chooser() as fc_info: page.get_by_text("Upload file").click()file_chooser = fc_info.valuefile_chooser.set_files("myfile.pdf")

    async with page.expect_file_chooser() as fc_info: await page.get_by_text("Upload file").click()file_chooser = await fc_info.valueawait file_chooser.set_files("myfile.pdf")


Methods


set_files

Added before v1.9 fileChooser.set_files

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.

Usage

file_chooser.set_files(files)file_chooser.set_files(files, **kwargs)

Arguments

Returns


Properties


element

Added before v1.9 fileChooser.element

Returns input element associated with this file chooser.

Usage

file_chooser.element

Returns


is_multiple

Added before v1.9 fileChooser.is_multiple

Returns whether this file chooser accepts multiple files.

Usage

file_chooser.is_multiple()

Returns


page

Added before v1.9 fileChooser.page

Returns page this file chooser belongs to.

Usage

file_chooser.page

Returns