Class: Selenium::WebDriver::Remote::Http::Default

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey-patches/webdriver-patches.rb

Instance Method Summary collapse

Instance Method Details

#new_http_clientObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/monkey-patches/webdriver-patches.rb', line 43

def new_http_client
  if @proxy
    unless @proxy.respond_to?(:http) && url = @proxy.http
      raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}"
    end

    proxy = URI.parse(url)

    clazz = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password)
    clazz.new(server_url.host, server_url.port)
  else
    Net::HTTP.new server_url.host, server_url.port
  end
end