class Scoutui::Base::QHarMgr

Attributes

proxy[RW]
proxy_binary[RW]
seleniumProfile[RW]

Public Class Methods

new() click to toggle source
# File lib/scoutui/base/q_har_mgr.rb, line 15
def initialize()
  puts __FILE__ + (__LINE__).to_s + " -- start BrowserMob --" if Scoutui::Utils::TestUtils.instance.isDebug?
  @proxy_binary = BrowserMob::Proxy::Server.new(ENV['BROWSER_MOB_BIN'], { :port => 8088 })
end

Public Instance Methods

capture_traffic() { || ... } click to toggle source
# File lib/scoutui/base/q_har_mgr.rb, line 46
def capture_traffic
 # @proxy.new_har
  yield
 @proxy.har
end
getSeleniumProfile() click to toggle source
# File lib/scoutui/base/q_har_mgr.rb, line 30
def getSeleniumProfile()
  puts __FILE__ + (__LINE__).to_s + " == getSeleniumProfile() => #{@seleniumProfile} --"
  @seleniumProfile
end
run(n) { || ... } click to toggle source
# File lib/scoutui/base/q_har_mgr.rb, line 52
    def run(n)
      puts __FILE__ + (__LINE__).to_s + " -- run --"
      @har = capture_traffic { yield }
#      @proxy.close
#      @har.save_to(n)
    end
start() click to toggle source
# File lib/scoutui/base/q_har_mgr.rb, line 20
def start()
  puts __FILE__ + (__LINE__).to_s + " --start --"
  @proxy_binary.start
  @proxy = @proxy_binary.create_proxy
  @seleniumProfile = @proxy.selenium_proxy  # Needed by Selenium instance

  @proxy.new_har(:capture_headers => true)
end
stop(save_as=nil) click to toggle source
# File lib/scoutui/base/q_har_mgr.rb, line 35
def stop(save_as=nil)
  puts __FILE__ + (__LINE__).to_s + " -- stop(#{save_as.to_s} --"
#  @proxy.close

  if !save_as.nil?
    @proxy.har.save_to(save_as)
  end

  @proxy.close
end