Class: AePageObjects::MultipleWindows::WindowList
- Inherits:
-
Object
- Object
- AePageObjects::MultipleWindows::WindowList
- Defined in:
- lib/ae_page_objects/multiple_windows/window_list.rb
Instance Method Summary collapse
- #add(window) ⇒ Object
- #close_all ⇒ Object
- #current_window ⇒ Object
-
#initialize ⇒ WindowList
constructor
A new instance of WindowList.
- #opened ⇒ Object
- #remove(window) ⇒ Object
Constructor Details
#initialize ⇒ WindowList
Returns a new instance of WindowList.
7 8 9 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 7 def initialize @windows = {} end |
Instance Method Details
#add(window) ⇒ Object
11 12 13 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 11 def add(window) @windows[window.handle] = window end |
#close_all ⇒ Object
38 39 40 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 38 def close_all opened.each(&:close) end |
#current_window ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 25 def current_window current_handle = WindowHandleManager.current window_for(current_handle) if current_handle rescue WindowNotFound synchronize_windows if current_window = @windows[@windows.keys.sort.first] current_window.switch_to current_window end end |
#opened ⇒ Object
19 20 21 22 23 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 19 def opened WindowHandleManager.all.map do |handle| window_for(handle) end end |
#remove(window) ⇒ Object
15 16 17 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 15 def remove(window) @windows.delete(window.handle) end |