Class: Ferrum::Dialog
- Inherits:
-
Object
- Object
- Ferrum::Dialog
- Defined in:
- lib/ferrum/dialog.rb
Instance Attribute Summary collapse
-
#default_prompt ⇒ Object
readonly
Returns the value of attribute default_prompt.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #accept(prompt_text = nil) ⇒ Object
- #dismiss ⇒ Object
-
#initialize(page, params) ⇒ Dialog
constructor
A new instance of Dialog.
- #match?(regexp) ⇒ Boolean
Constructor Details
#initialize(page, params) ⇒ Dialog
Returns a new instance of Dialog.
7 8 9 10 11 |
# File 'lib/ferrum/dialog.rb', line 7 def initialize(page, params) @page = page @message = params["message"] @default_prompt = params["defaultPrompt"] end |
Instance Attribute Details
#default_prompt ⇒ Object (readonly)
Returns the value of attribute default_prompt.
5 6 7 |
# File 'lib/ferrum/dialog.rb', line 5 def default_prompt @default_prompt end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/ferrum/dialog.rb', line 5 def @message end |
Instance Method Details
#accept(prompt_text = nil) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ferrum/dialog.rb', line 13 def accept(prompt_text = nil) = { accept: true } response = prompt_text || default_prompt .merge!(promptText: response) if response @page.command("Page.handleJavaScriptDialog", slowmoable: true, **) end |
#dismiss ⇒ Object
20 21 22 |
# File 'lib/ferrum/dialog.rb', line 20 def dismiss @page.command("Page.handleJavaScriptDialog", slowmoable: true, accept: false) end |
#match?(regexp) ⇒ Boolean
24 25 26 |
# File 'lib/ferrum/dialog.rb', line 24 def match?(regexp) !!.match(regexp) end |