Class: Vapir::IE::ModalDialog
- Inherits:
-
Object
- Object
- Vapir::IE::ModalDialog
- Includes:
- ModalDialog
- Defined in:
- lib/vapir-ie/modal_dialog.rb
Instance Method Summary collapse
- #click_button(button_text, options = {}) ⇒ Object
- #close ⇒ Object
- #document ⇒ Object
- #exists? ⇒ Boolean
- #hwnd ⇒ Object
- #locate ⇒ Object
- #set_text_field(value) ⇒ Object
- #text ⇒ Object
- #win_window ⇒ Object
Instance Method Details
#click_button(button_text, options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/vapir-ie/modal_dialog.rb', line 29 def (, ={}) assert_exists =(, :timeout => ModalDialog::DEFAULT_TIMEOUT) @modal_window.(, [:timeout]) end |
#close ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vapir-ie/modal_dialog.rb', line 35 def close if (document=IE::ModalDialogDocument.new(self, :error => false, :timeout => 0)) && document.exists? document.close else @modal_window.send_close! end ::Waiter.try_for(ModalDialog::DEFAULT_TIMEOUT, :exception => Vapir::Exception::WindowException.new("The modal window failed to close")) do !exists? end end |
#document ⇒ Object
54 55 56 57 |
# File 'lib/vapir-ie/modal_dialog.rb', line 54 def document assert_exists IE::ModalDialogDocument.new(self) end |
#exists? ⇒ Boolean
13 14 15 |
# File 'lib/vapir-ie/modal_dialog.rb', line 13 def exists? @modal_window && @modal_window.exists? end |
#hwnd ⇒ Object
46 47 48 49 |
# File 'lib/vapir-ie/modal_dialog.rb', line 46 def hwnd assert_exists @modal_window.hwnd end |
#locate ⇒ Object
9 10 11 |
# File 'lib/vapir-ie/modal_dialog.rb', line 9 def locate @modal_window=@browser.win_window.enabled_popup end |
#set_text_field(value) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/vapir-ie/modal_dialog.rb', line 22 def set_text_field(value) assert_exists edit_field=@modal_window.children.detect{|child| child.class_name=='Edit'} || (raise "No Edit field in the popup!") edit_field.send_set_text!(value) value end |
#text ⇒ Object
17 18 19 20 |
# File 'lib/vapir-ie/modal_dialog.rb', line 17 def text assert_exists @modal_window.children.select{|child| child.class_name.downcase=='static' && child.text!=''}.map{|c| c.text }.join(' ') end |
#win_window ⇒ Object
50 51 52 |
# File 'lib/vapir-ie/modal_dialog.rb', line 50 def win_window @modal_window end |