module WebkitRemote

Top-level namespace.

Public Class Methods

local(opts = {}) click to toggle source

Launches a WebKit process locally, and sets up a debugger client for it.

@param (see WebkitRemote::Process#initialize) @option (see WebkitRemote::Process#initialize) @return [WebkitRemote::Client] a debugging client connected to a local

WebKit process; the client will automatically stop the process when
closed
# File lib/webkit_remote/top_level.rb, line 10
def self.local(opts = {})
  # Use headless if no desktop is available.
  if !opts.has_key?(:headless) && (!ENV['DISPLAY'] || ENV['DISPLAY'].empty?)
    opts = { headless: true }.merge! opts
  end
  process = WebkitRemote::Process.new opts

  browser = process.start
  browser.stop_process = true
  client = WebkitRemote::Client.new tab: browser.tabs.first,
                                    close_browser: true
  client
end
remote(opts = {}) click to toggle source

Connects to a Webkit process, and sets up a debugger client for it.

@param (see WebkitRemote::Browser#initialize) @return [WebkitRemote::Client] a debugging client connected to the remote

WebKit process; the connection will be automatically terminated when
the debugging client is closed
# File lib/webkit_remote/top_level.rb, line 30
def self.remote(opts = {})
  browser = WebkitRemote::Browser.new opts
  # NOTE: connecting to the last tab to avoid internal tabs and whatnot
  client = WebkitRemote::Client.new tab: browser.tabs.last,
                                    close_browser: true
  client
end