module Scoutui::Commands class UpdateUrl < Command def execute(drv) @drv=drv if !drv.nil? _req = Scoutui::Utils::TestUtils.instance.getReq() baseUrl = Scoutui::Base::UserVars.instance.getHost() url = @cmd.match(/navigate\s*\((.*)\)/i)[1].to_s.strip Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " url => #{url}" if Scoutui::Utils::TestUtils.instance.isDebug? _relativeUrl = url.strip.start_with?('/') if _relativeUrl Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " [relative url]: #{baseUrl} with #{url}" if Scoutui::Utils::TestUtils.instance.isDebug? url = baseUrl + url end url = Scoutui::Base::UserVars.instance.get(url) Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | translate : #{url}" if Scoutui::Utils::TestUtils.instance.isDebug? _rc=false begin Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " navigate.to(#{url})" _start=Time.now @drv.navigate.to(url) _stop=Time.now _duration=_stop - _start puts __FILE__ + (__LINE__).to_s + " Perf navigate to #{url} : #{_duration}" Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => title #{@drv.title.to_s}" _rc=true rescue => ex Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex.message}" Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}" end setResult(_rc) end end end