Class: Playwright::FileChooser

Inherits:
PlaywrightApi show all
Defined in:
lib/playwright_api/file_chooser.rb

Overview

FileChooser objects are dispatched by the page in the [‘event: Page.filechooser`] event.

“‘js page.on(’filechooser’, async (fileChooser) =>

await fileChooser.setFiles('/tmp/myfile.pdf');

); “‘

“‘python async page.on(“filechooser”, lambda file_chooser: file_chooser.set_files(“/tmp/myfile.pdf”)) “`

“‘python sync page.on(“filechooser”, lambda file_chooser: file_chooser.set_files(“/tmp/myfile.pdf”)) “`

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#==, from_channel_owner, #initialize

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#elementObject

Returns input element associated with this file chooser.

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/playwright_api/file_chooser.rb', line 21

def element
  raise NotImplementedError.new('element is not implemented yet.')
end

#multiple?Boolean

Returns whether this file chooser accepts multiple files.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/playwright_api/file_chooser.rb', line 26

def multiple?
  raise NotImplementedError.new('multiple? is not implemented yet.')
end

#pageObject

Returns page this file chooser belongs to.

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/playwright_api/file_chooser.rb', line 31

def page
  raise NotImplementedError.new('page is not implemented yet.')
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.

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/playwright_api/file_chooser.rb', line 37

def set_files(files, noWaitAfter: nil, timeout: nil)
  raise NotImplementedError.new('set_files is not implemented yet.')
end