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.
4 5 6 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 4 def initialize @windows = {} end |
Instance Method Details
#add(window) ⇒ Object
8 9 10 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 8 def add(window) @windows[window.handle] = window end |
#close_all ⇒ Object
35 36 37 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 35 def close_all opened.each(&:close) end |
#current_window ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 22 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
16 17 18 19 20 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 16 def opened WindowHandleManager.all.map do |handle| window_for(handle) end end |
#remove(window) ⇒ Object
12 13 14 |
# File 'lib/ae_page_objects/multiple_windows/window_list.rb', line 12 def remove(window) @windows.delete(window.handle) end |