Sha256: a6bafd16782eca2e7fc827180a6f2e713f93c8d96a7624f9fe80994589384268
Contents?: true
Size: 1008 Bytes
Versions: 1
Compression:
Stored size: 1008 Bytes
Contents
module BrowserMob module Proxy class Client def self.from(server_url) port = JSON.parse( RestClient.post(URI.join(server_url, "proxy").to_s, '') ).fetch('port') uri = URI.parse(File.join(server_url, "proxy", port.to_s)) resource = RestClient::Resource.new(uri.to_s) Client.new resource, uri.host, port end def initialize(resource, host, port) @resource = resource @host = host @port = port end def new_har(initial_page_ref) previous = @resource["har"].put :initialPageRef => initial_page_ref HAR::Archive.from_string(previous) unless previous.empty? end def har HAR::Archive.from_string @resource["har"].get end def selenium_proxy require 'selenium-webdriver' unless defined?(Selenium) Selenium::WebDriver::Proxy.new(:http => "#{@host}:#{@port}") end def close @resource.delete end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
browsermob-proxy-0.0.1 | lib/browsermob/proxy/client.rb |