Parent

Webrat::Selenium::SeleniumRCServer

Public Class Methods

boot() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 8
def self.boot
  new.boot
end

Public Instance Methods

boot() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 12
def boot
  return if selenium_grid?

  start
  wait
  stop_at_exit
end
fail() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 71
def fail
  $stderr.puts
  $stderr.puts
  $stderr.puts "==> Failed to boot the Selenium RC server... exiting!"
  exit
end
jar_path() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 46
def jar_path
  File.expand_path(__FILE__ + "../../../../../vendor/selenium-server.jar")
end
remote_control() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 32
def remote_control
  return @remote_control if @remote_control
  server_options = { :timeout => Webrat.configuration.selenium_browser_startup_timeout }
  server_options[:firefox_profile] = Webrat.configuration.selenium_firefox_profile if Webrat.configuration.selenium_firefox_profile

  @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
                                                                 Webrat.configuration.selenium_server_port,
                                                                 server_options)

  @remote_control.jar_file = jar_path

  return @remote_control
end
selenium_grid?() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 50
def selenium_grid?
  Webrat.configuration.selenium_server_address
end
start() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 20
def start
  silence_stream(STDOUT) do
    remote_control.start :background => true
  end
end
stop() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 78
def stop
  silence_stream(STDOUT) do
    ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
                                                 Webrat.configuration.selenium_server_port,
                                                 :timeout => 5).stop
  end
end
stop_at_exit() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 26
def stop_at_exit
  at_exit do
    stop
  end
end
wait() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 54
def wait
  $stderr.print "==> Waiting for Selenium RC server on port #{Webrat.configuration.selenium_server_port}... "
  wait_for_socket
  $stderr.print "Ready!\n"
rescue SocketError
  fail
end
wait_for_socket() click to toggle source
# File lib/webrat/selenium/selenium_rc_server.rb, line 62
def wait_for_socket
  silence_stream(STDOUT) do
    TCPSocket.wait_for_service_with_timeout              :host     => (Webrat.configuration.selenium_server_address || "0.0.0.0"),
      :port     => Webrat.configuration.selenium_server_port,
      :timeout  => 45 # seconds
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.