Class: Webrat::Selenium::SeleniumRCServer
- Inherits:
-
Object
- Object
- Webrat::Selenium::SeleniumRCServer
- Includes:
- SilenceStream
- Defined in:
- lib/webrat/selenium/selenium_rc_server.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) boot
- - (Object) fail
- - (Object) jar_path
- - (Object) remote_control
- - (Boolean) selenium_grid?
- - (Object) start
- - (Object) stop
- - (Object) stop_at_exit
- - (Object) wait
- - (Object) wait_for_socket
Methods included from SilenceStream
Class Method Details
+ (Object) boot
8 9 10 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 8 def self.boot new.boot end |
Instance Method Details
- (Object) boot
12 13 14 15 16 17 18 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 12 def boot return if selenium_grid? start wait stop_at_exit end |
- (Object) fail
71 72 73 74 75 76 |
# 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 |
- (Object) jar_path
46 47 48 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 46 def jar_path File.(__FILE__ + "../../../../../vendor/selenium-server.jar") end |
- (Object) remote_control
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 32 def remote_control return @remote_control if @remote_control = { :timeout => Webrat.configuration.selenium_browser_startup_timeout } [: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, ) @remote_control.jar_file = jar_path return @remote_control end |
- (Boolean) selenium_grid?
50 51 52 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 50 def selenium_grid? Webrat.configuration.selenium_server_address end |
- (Object) start
20 21 22 23 24 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 20 def start silence_stream(STDOUT) do remote_control.start :background => true end end |
- (Object) stop
78 79 80 81 82 83 84 |
# 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 |
- (Object) stop_at_exit
26 27 28 29 30 |
# File 'lib/webrat/selenium/selenium_rc_server.rb', line 26 def stop_at_exit at_exit do stop end end |
- (Object) wait
54 55 56 57 58 59 60 |
# 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 |
- (Object) wait_for_socket
62 63 64 65 66 67 68 69 |
# 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 |