class Capybara::Apparition::Browser::Launcher::Remote
Attributes
ws_url[R]
Public Class Methods
new(options)
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 16 def initialize(options) @remote_host = options.fetch('remote-debugging-address', '127.0.0.1') @remote_port = options.fetch('remote-debugging-port', '9222') end
start(options)
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 12 def self.start(options) new(options).tap(&:start) end
Public Instance Methods
host()
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 35 def host ws_url.host end
port()
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 39 def port ws_url.port end
restart()
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 31 def restart # Remote instance cannot be restarted end
start()
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 21 def start @ws_url = Addressable::URI.parse(get_ws_url(@remote_host, @remote_port)) true end
stop()
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 27 def stop # Remote instance cannot be stopped end
Protected Instance Methods
get_ws_url(host, port)
click to toggle source
# File lib/capybara/apparition/browser/launcher/remote.rb, line 45 def get_ws_url(host, port) response = Net::HTTP.get(host, '/json/version', port) response = JSON.parse(response) response['webSocketDebuggerUrl'] rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH raise ArgumentError, "Cannot connect to remote Chrome at: 'http://#{host}:#{port}/json/version'" end