Class: Capybara::Apparition::Browser::Launcher::Remote

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/apparition/browser/launcher/remote.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Remote

Returns a new instance of Remote.



16
17
18
19
# 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

Instance Attribute Details

#ws_urlObject (readonly)

Returns the value of attribute ws_url.



10
11
12
# File 'lib/capybara/apparition/browser/launcher/remote.rb', line 10

def ws_url
  @ws_url
end

Class Method Details

.start(options) ⇒ Object



12
13
14
# File 'lib/capybara/apparition/browser/launcher/remote.rb', line 12

def self.start(options)
  new(options).tap(&:start)
end

Instance Method Details

#hostObject



35
36
37
# File 'lib/capybara/apparition/browser/launcher/remote.rb', line 35

def host
  ws_url.host
end

#portObject



39
40
41
# File 'lib/capybara/apparition/browser/launcher/remote.rb', line 39

def port
  ws_url.port
end

#restartObject



31
32
33
# File 'lib/capybara/apparition/browser/launcher/remote.rb', line 31

def restart
  # Remote instance cannot be restarted
end

#startObject



21
22
23
24
25
# 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

#stopObject



27
28
29
# File 'lib/capybara/apparition/browser/launcher/remote.rb', line 27

def stop
  # Remote instance cannot be stopped
end