Method: WebkitRemote::Browser#initialize

Defined in:
lib/webkit_remote/browser.rb

#initialize(opts = {}) ⇒ Browser

Sets up a debugging connection to a Webkit process.

Options Hash (opts):

  • host (String)

    the hostname / IP address of the Webkit remote debugging server

  • port (Integer)

    the port that the Webkit remote debugging server listens to

  • process (WebkitRemote::Process)

    a process on the local machine to connect to; the process will automatically be stopped when the debugging connection is closed; the host and port will be configured automatically

  • stop_process (Boolean)

    if true, the WebkitRemote::Process passed to the constructor will be automatically stopped

Raises:

  • (SystemCallError)

    if the connection could not be established; this most likely means that there is no remote debugging server at the given host / port



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/webkit_remote/browser.rb', line 24

def initialize(opts = {})
  if opts[:process]
    @process = opts[:process]
    @stop_process = opts.fetch :stop_process, false
    @host = 'localhost'
    @port = process.port
  else
    @process = nil
    @stop_process = false
    @host = opts[:host] || 'localhost'
    @port = opts[:port] || 9292
  end
  @closed = false

  @http = Net::HTTP.start @host, @port
end