Class: Webrat::Selenium::SeleniumRCServer
- Defined in:
- lib/webrat/selenium/selenium_rc_server.rb
Class Method Summary collapse
Instance Method Summary collapse
- #boot ⇒ Object
- #fail ⇒ Object
- #jar_path ⇒ Object
- #remote_control ⇒ Object
- #selenium_grid? ⇒ Boolean
- #start ⇒ Object
- #stop ⇒ Object
- #stop_at_exit ⇒ Object
- #wait ⇒ Object
- #wait_for_socket ⇒ Object
Class Method Details
.boot ⇒ Object
6 7 8 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 6 def self.boot new.boot end |
Instance Method Details
#boot ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 10 def boot return if selenium_grid? start wait stop_at_exit end |
#fail ⇒ Object
65 66 67 68 69 70 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 65 def fail $stderr.puts $stderr.puts $stderr.puts "==> Failed to boot the Selenium RC server... exiting!" exit end |
#jar_path ⇒ Object
40 41 42 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 40 def jar_path File.(__FILE__ + "../../../../../vendor/selenium-server.jar") end |
#remote_control ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 30 def remote_control return @remote_control if @remote_control @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", Webrat.configuration.selenium_server_port, 5) @remote_control.jar_file = jar_path @remote_control.additional_args = Webrat.configuration.selenium_additional_startup_args return @remote_control end |
#selenium_grid? ⇒ Boolean
44 45 46 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 44 def selenium_grid? Webrat.configuration.selenium_server_address end |
#start ⇒ Object
18 19 20 21 22 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 18 def start silence_stream(STDOUT) do remote_control.start :background => true end end |
#stop ⇒ Object
72 73 74 75 76 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 72 def stop silence_stream(STDOUT) do ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", Webrat.configuration.selenium_server_port, 5).stop end end |
#stop_at_exit ⇒ Object
24 25 26 27 28 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 24 def stop_at_exit at_exit do stop end end |
#wait ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 48 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 ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 56 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 => 15 # seconds end end |