lib/scoutui/commands/utils.rb in scoutui-2.0.2 vs lib/scoutui/commands/utils.rb in scoutui-2.0.3.pre
- old
+ new
@@ -8,16 +8,18 @@
include Singleton
attr_accessor :totalCommands
attr_accessor :timeout
attr_accessor :hwnds
+ attr_accessor :useFrameSearch
def initialize
@command_list=['pause',
'existsAlert',
'clickJsAlert',
'fillform',
+ 'frame',
'submitform',
'type',
'click',
'mouseover',
'navigate',
@@ -30,14 +32,49 @@
@timeout=30
@command_list.each do |c|
@totalCommands[c]=0
end
+ @useFrameSearch = false
+
@hwnds = { :current => nil, :previous => nil, :handles => [] }
end
+ def reset(stanza=nil)
+
+ setEnableFrameSearch(false)
+
+ if stanza.is_a?(Hash) && stanza.has_key?('page') && stanza['page'].has_key?('frames')
+ puts __FILE__ + (__LINE__).to_s + " frames => #{stanza['page']['frames']}";
+
+ setEnableFrameSearch(!stanza['page']['frames'].to_s.match(/true/i).nil?)
+ end
+ end
+
+ def resetFrameSearch()
+ setEnableFrameSearch(false)
+ end
+
+ def setEnableFrameSearch(b)
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " setEnabledFrameSearch(#{b})"
+ @userFrameSearch=b
+ end
+
+ def getFrameSearch()
+ @userFrameSearch
+ end
+
+ def enableFrameSearch()
+ Scoutui::Logger::LogMgr.instance.debug "EnableFrameSearch(true)"
+ setEnableFrameSearch(true)
+ end
+
+ def isFrameSearch?()
+ @userFrameSearch
+ end
+
def isCSS(_locator)
rc=nil
if _locator.match(/^css\=/i)
rc = _locator.match(/\s*(css\=.*)/i)[1].to_s.strip
@@ -64,10 +101,11 @@
end
def setTimeout(_t)
@timeout=_t.to_i
end
+
def getTimeout()
@timeout.to_i
end
def isSelectWindow?(_action)
@@ -77,10 +115,14 @@
def isExistsAlert?(_action)
!_action.match(/(exist[s]*_*alert|existAlert|existsAlert|existsJsAlert|existsJsConfirm|existsJsPrompt)\(/i).nil?
end
+ def isFrame?(_action)
+ _action.match(/^\s*(frame|switchframe|switch_frame)\s*\(/i)
+ end
+
def isVerifyElt?(_action)
!_action.match(/(verifyelt|verifyelement)\(/i).nil?
end
def isClick?(_action)
@@ -129,9 +171,11 @@
if isPause?(cmd)
@totalCommands['pause']+=1
elsif isExistsAlert?(cmd)
@totalCommands['existsAlert']+=1
+ elsif isFrame?(cmd)
+ @totalCommands['frame']+=1
elsif isGetAlert?(cmd)
@totalCommands['clickJsAlert']+=1
elsif isVerifyElt?(cmd)
@totalCommands['verifyelt']+=1
elsif isVerifyForm?(cmd)