Class: Watir::ModalDialog
- Inherits:
-
Object
- Object
- Watir::ModalDialog
- Includes:
- Container, PageContainer
- Defined in:
- lib/watir-classic/modal_dialog.rb
Overview
Returned by Container#modal_dialog.
Instance Attribute Summary
Attributes included from Container
Instance Method Summary collapse
-
#active? ⇒ Boolean
True when modal window is active/in focus, false otherwise.
-
#close(timeout = 5) ⇒ Object
Close the modal dialog.
-
#exists? ⇒ Boolean
(also: #exist?)
True when dialog exists, false otherwise.
-
#focus ⇒ Object
Brings the modal dialog to front.
-
#hwnd ⇒ Fixnum
Window handle of the dialog.
-
#initialize(container) ⇒ ModalDialog
constructor
A new instance of ModalDialog.
-
#title ⇒ String
Title of the dialog.
Methods included from PageContainer
#contains_text, #execute_script, #html, #text, #url
Methods included from Exception
Methods included from Container
#a, #abbr, #address, #alert, #area, #article, #aside, #audio, #b, #base, #bdi, #bdo, #blockquote, #body, #br, #button, #canvas, #caption, #checkbox, #cite, #code, #col, #colgroup, #command, #data, #datalist, #dd, #del, #details, #dfn, #div, #dl, #dt, #element, #em, #embed, #fieldset, #figcaption, #figure, #file_field, #font, #footer, #form, #frame, #frameset, #h1, #h2, #h3, #h4, #h5, #h6, #head, #header, #hgroup, #hidden, #hr, #i, #img, #input, #ins, #kbd, #keygen, #label, #legend, #li, #map, #mark, #menu, #meta, #meter, #modal_dialog, #nav, #noscript, #object, #ol, #optgroup, #option, #output, #p, #param, #pre, #progress, #q, #radio, #rp, #rt, #ruby, #s, #samp, #script, #section, #select, #small, #source, #span, #strong, #style, #sub, #summary, #sup, #table, #tbody, #td, #text_field, #textarea, #tfoot, #th, #thead, #time, #tr, #track, #u, #ul, #var, #video, #wbr
Constructor Details
#initialize(container) ⇒ ModalDialog
Returns a new instance of ModalDialog.
8 9 10 11 |
# File 'lib/watir-classic/modal_dialog.rb', line 8 def initialize(container) set_container container @modal = ::RAutomation::Window.new(:hwnd => @container.hwnd).child(:class => 'Internet Explorer_TridentDlgFrame') end |
Instance Method Details
#active? ⇒ Boolean
Returns true when modal window is active/in focus, false otherwise.
40 41 42 |
# File 'lib/watir-classic/modal_dialog.rb', line 40 def active? @modal.active? end |
#close(timeout = 5) ⇒ Object
Close the modal dialog.
27 28 29 30 31 32 |
# File 'lib/watir-classic/modal_dialog.rb', line 27 def close(timeout=5) return unless exists? document.parentWindow.close Watir::Wait.until(timeout) {!exists?} rescue nil wait end |
#exists? ⇒ Boolean Also known as: exist?
Returns true when dialog exists, false otherwise.
45 46 47 |
# File 'lib/watir-classic/modal_dialog.rb', line 45 def exists? @modal.exists? end |
#focus ⇒ Object
Brings the modal dialog to front.
19 20 21 |
# File 'lib/watir-classic/modal_dialog.rb', line 19 def focus @modal.activate end |
#hwnd ⇒ Fixnum
Returns window handle of the dialog.
35 36 37 |
# File 'lib/watir-classic/modal_dialog.rb', line 35 def hwnd @modal.hwnd end |
#title ⇒ String
Returns title of the dialog.
14 15 16 |
# File 'lib/watir-classic/modal_dialog.rb', line 14 def title document.title end |