Class: AutomationObject::State::NewScreen
- Inherits:
-
ActionLoop
- Object
- ActionLoop
- AutomationObject::State::NewScreen
- Defined in:
- lib/automation_object/state/hook_actions/new_screen.rb
Overview
New screen hook loop
Instance Attribute Summary
Attributes inherited from ActionLoop
#blue_prints, #composite, #driver, #loops
Instance Method Summary collapse
-
#initialize(composite, driver, blue_prints, loops = 1) ⇒ NewScreen
constructor
A new instance of NewScreen.
- #single_run ⇒ Object
Methods inherited from ActionLoop
Constructor Details
#initialize(composite, driver, blue_prints, loops = 1) ⇒ NewScreen
Returns a new instance of NewScreen
14 15 16 17 18 19 |
# File 'lib/automation_object/state/hook_actions/new_screen.rb', line 14 def initialize(composite, driver, blue_prints, loops = 1) self.composite = composite self.driver = driver self.blue_prints = blue_prints self.loops = loops end |
Instance Method Details
#single_run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/automation_object/state/hook_actions/new_screen.rb', line 21 def single_run new_screen = composite.top.screens[blue_prints] stored_window_handles = composite.top.screens.values .each_with_object([]) do |screen, a| a.push(screen.window_handle) unless screen.window_handle.nil? a end driver_handles = driver.window_handles return false if driver_handles.length <= stored_window_handles.length raise MoreThenOneScreenCreated if (driver_handles.length - stored_window_handles.length) > 1 new_window_handle = (driver_handles - stored_window_handles)[0] driver.window_handle = new_window_handle 30.times do next unless driver.document_complete? next if new_screen.load.live? == false new_screen.activate return true end false end |