Class: Playwright::FileChooser
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::FileChooser
- Defined in:
- lib/playwright_api/file_chooser.rb
Overview
‘FileChooser` objects are dispatched by the page in the [`event: Page.fileChooser`] event.
“‘js const [fileChooser] = await Promise.all([
page.waitForEvent('filechooser'),
page.click('upload')
]); await fileChooser.setFiles(‘myfile.pdf’); “‘
“‘python async async with page.expect_file_chooser() as fc_info:
await page.click("upload")
file_chooser = await fc_info.value await file_chooser.set_files(“myfile.pdf”) “‘
“‘python sync with page.expect_file_chooser() as fc_info:
page.click("upload")
file_chooser = fc_info.value file_chooser.set_files(“myfile.pdf”) “‘
Instance Method Summary collapse
-
#element ⇒ Object
Returns input element associated with this file chooser.
-
#multiple? ⇒ Boolean
Returns whether this file chooser accepts multiple files.
-
#page ⇒ Object
Returns page this file chooser belongs to.
-
#set_files(files, noWaitAfter: nil, timeout: nil) ⇒ Object
(also: #files=)
Sets the value of the file input this chooser is associated with.
Methods inherited from PlaywrightApi
Constructor Details
This class inherits a constructor from Playwright::PlaywrightApi
Instance Method Details
#element ⇒ Object
Returns input element associated with this file chooser.
29 30 31 |
# File 'lib/playwright_api/file_chooser.rb', line 29 def element wrap_impl(@impl.element) end |
#multiple? ⇒ Boolean
Returns whether this file chooser accepts multiple files.
34 35 36 |
# File 'lib/playwright_api/file_chooser.rb', line 34 def multiple? wrap_impl(@impl.multiple?) end |
#page ⇒ Object
Returns page this file chooser belongs to.
39 40 41 |
# File 'lib/playwright_api/file_chooser.rb', line 39 def page wrap_impl(@impl.page) end |
#set_files(files, noWaitAfter: nil, timeout: nil) ⇒ Object Also known as: 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 the current working directory. For empty array, clears the selected files.
45 46 47 |
# File 'lib/playwright_api/file_chooser.rb', line 45 def set_files(files, noWaitAfter: nil, timeout: nil) wrap_impl(@impl.set_files(unwrap_impl(files), noWaitAfter: unwrap_impl(noWaitAfter), timeout: unwrap_impl(timeout))) end |