class Scoutui::Commands::SwitchFrame
Public Instance Methods
execute(drv, _e=nil)
click to toggle source
# 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)
click to toggle source
Recurses into all iframe and/or frame tags
# 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