Class: Scoutui::Commands::SwitchFrame
- Defined in:
- lib/scoutui/commands/switch_frame.rb
Instance Attribute Summary
Attributes inherited from Command
#bm, #cmd, #description, #drv, #enableAssert, #executed, #executed_result, #locator, #rc, #stanza
Instance Method Summary collapse
- #execute(drv, _e = nil) ⇒ Object
-
#xxexecute(drv, _e = nil) ⇒ Object
Recurses into all iframe and/or frame tags.
Methods inherited from Command
#assert?, #disableAssert, #disableAsserts, #enableAsserts, #executedResult, #getLocator, #initialize, #passed?, #result, #run, #setBenchmark, #setLocator, #setResult, #wasExecuted?
Constructor Details
This class inherits a constructor from Scoutui::Commands::Command
Instance Method Details
#execute(drv, _e = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/scoutui/commands/switch_frame.rb', line 6 def execute(drv, _e=nil) @drv=drv if !drv.nil? _locator = @cmd.match(/frame\s*\((.*)\)/)[1].to_s.strip Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frame : #{_locator}" rc = Array.new() frames = @drv.find_elements(:xpath, '//iframe') if frames.size == 0 frames = @drv.find_elements(:xpath, '//frame') end if frames.size > 0 rc.concat frames end _obj = @drv.find_elements(:xpath, _locator) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}" if _obj.empty? for i in 0 .. (frames.size - 1) _name = frames[i].attribute('name') Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{frames[i].attribute('name')}" @drv.switch_to.frame _name # @drv.switch_to.frame i _hits = execute(drv, _e) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hits => #{_hits}" @drv.switch_to.parent_frame if _hits.size > 0 _obj=_hits break end end end Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj => #{_obj}" _obj end |
#xxexecute(drv, _e = nil) ⇒ Object
Recurses into all iframe and/or frame tags
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/scoutui/commands/switch_frame.rb', line 70 def xxexecute(drv, _e=nil) @drv=drv if !drv.nil? _locator = @cmd.match(/frame\s*\((.*)\)/)[1].to_s.strip Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frame : #{_locator}" rc = Array.new() frames = @drv.find_elements(:xpath, '//iframe') if frames.size == 0 frames = @drv.find_elements(:xpath, '//frame') end if frames.size > 0 rc.concat frames end _obj = @drv.find_elements(:xpath, _locator) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}" for i in 0 .. (frames.size - 1) _name = frames[i].attribute('name') Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{frames[i].attribute('name')}" @drv.switch_to.frame _name # @drv.switch_to.frame i _hits = execute(drv, _e) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hits => #{_hits}" rc.concat _hits if !_hits.empty? @drv.switch_to.parent_frame end Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " rc => #{rc}" rc end |