Parent

Class/Module Index [+]

Quicksearch

Selenium::Server

Wraps the remote server jar

Public Class Methods

new(jar, opts = {}) click to toggle source
# File lib/selenium/server.rb, line 13
def initialize(jar, opts = {})
  raise Errno::ENOENT, jar unless File.exist?(jar)

  @jar        = jar
  @host       = "127.0.0.1"
  @port       = opts.fetch(:port, 4444)
  @timeout    = opts.fetch(:timeout, 30)
  @background = opts.fetch(:background, false)
  @log        = opts[:log]

  @additional_args = []
end

Public Instance Methods

<<(arg) click to toggle source
# File lib/selenium/server.rb, line 55
def <<(arg)
  if arg.kind_of?(Array)
    @additional_args += arg
  else
    @additional_args << arg.to_s
  end
end
start() click to toggle source
# File lib/selenium/server.rb, line 26
def start
  process.start
  poll_for_service

  unless @background
    begin
      sleep 1 while process.alive?
    rescue Errno::ECHILD
      # no longer alive
    end
  end
end
stop() click to toggle source
# File lib/selenium/server.rb, line 39
def stop
  begin
    Net::HTTP.get(@host, "/selenium-server/driver/?cmd=shutDownSeleniumServer", @port)
  rescue Errno::ECONNREFUSED
  end

  stop_process if @process
  poll_for_shutdown

  @log_file.close if @log_file
end
webdriver_url() click to toggle source
# File lib/selenium/server.rb, line 51
def webdriver_url
  "http://#{@host}:#{@port}/wd/hub"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.