Module: Watirloo::Desktop
- Defined in:
- lib/watirloo/desktop.rb
Overview
The browser desktop manager checks to see what browsers already exist on the dekstop. compares what is on the desktop to what was there last time
Class Method Summary collapse
-
.additions(known_hwnds) ⇒ Object
returns handles for browsers that appeared on Desktop since the last scan for browsers.
-
.browsers ⇒ Object
returns browser windows found on the desktop.
-
.clear ⇒ Object
Closes all the browsers on the desktop.
-
.deletions(known_hwnds) ⇒ Object
returns handles for browsers no longer found on the Desktop since the last scan for browsers.
-
.hwnds ⇒ Object
return handles of Browsers found on desktop.
Class Method Details
.additions(known_hwnds) ⇒ Object
returns handles for browsers that appeared on Desktop since the last scan for browsers
25 26 27 |
# File 'lib/watirloo/desktop.rb', line 25 def additions(known_hwnds) hwnds.select {|h| !known_hwnds.include?(h)} end |
.browsers ⇒ Object
returns browser windows found on the desktop
11 12 13 14 15 |
# File 'lib/watirloo/desktop.rb', line 11 def browsers brs =[] Watir::IE.each {|ie| brs << ie } brs end |
.clear ⇒ Object
Closes all the browsers on the desktop. Creats a known clear slate where no browsers exist
36 37 38 39 40 |
# File 'lib/watirloo/desktop.rb', line 36 def clear browsers.each {|ie| ie.close; sleep 3} sleep 3 raise Exception, "Failed to clear all the browsers from the desktop" unless browsers.empty? end |
.deletions(known_hwnds) ⇒ Object
returns handles for browsers no longer found on the Desktop since the last scan for browsers
30 31 32 |
# File 'lib/watirloo/desktop.rb', line 30 def deletions(known_hwnds) known_hwnds.select {|h| !hwnds.include?(h)} end |
.hwnds ⇒ Object
return handles of Browsers found on desktop
18 19 20 21 22 |
# File 'lib/watirloo/desktop.rb', line 18 def hwnds hs =[] browsers.each {|ie| hs << ie.hwnd} hs end |