Class: Puppeteer::FileChooser
- Inherits:
-
Object
- Object
- Puppeteer::FileChooser
- Defined in:
- lib/puppeteer/file_chooser.rb
Instance Method Summary collapse
- #accept(file_paths) ⇒ Object
- #cancel ⇒ Object
-
#initialize(element, event) ⇒ FileChooser
constructor
A new instance of FileChooser.
- #multiple? ⇒ Boolean
Constructor Details
#initialize(element, event) ⇒ FileChooser
Returns a new instance of FileChooser.
4 5 6 7 8 |
# File 'lib/puppeteer/file_chooser.rb', line 4 def initialize(element, event) @element = element @multiple = event['mode'] != 'selectSingle' @handled = false end |
Instance Method Details
#accept(file_paths) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/puppeteer/file_chooser.rb', line 15 def accept(file_paths) if @handled raise 'Cannot accept FileChooser which is already handled!' end @handled = true @element.upload_file(*file_paths) end |
#cancel ⇒ Object
23 24 25 26 27 28 |
# File 'lib/puppeteer/file_chooser.rb', line 23 def cancel if @handled raise 'Cannot cancel FileChooser which is already handled!' end @handled = true end |
#multiple? ⇒ Boolean
10 11 12 |
# File 'lib/puppeteer/file_chooser.rb', line 10 def multiple? @multiple end |