Class: Selenium::ServerManager

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/server_manager.rb

Overview

end

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server = SeleniumServer.new) ⇒ ServerManager

Returns a new instance of ServerManager.



26
27
28
29
# File 'lib/selenium/server_manager.rb', line 26

def initialize(server = SeleniumServer.new)
  @server = server
  @status = 'stopped'
end

Instance Attribute Details

#statusObject (readonly)

The status of the server. Values are

  • stopped

  • starting

  • started

  • stopping

  • error



20
21
22
# File 'lib/selenium/server_manager.rb', line 20

def status
  @status
end

Class Method Details

.on_port(port) ⇒ Object



22
23
24
# File 'lib/selenium/server_manager.rb', line 22

def ServerManager::on_port(port)
  ServerManager.new(SeleniumServer.new(port))
end

Instance Method Details

#startObject

Starts the server, returns when the server is up and running



32
33
34
35
36
# File 'lib/selenium/server_manager.rb', line 32

def start
  starting_server
  wait_for_condition {@server.running?}
  @status = 'started'
end

#stopObject

Stops the server, returns when the server is no longer running



39
40
41
42
43
# File 'lib/selenium/server_manager.rb', line 39

def stop
  stopping_server
  wait_for_condition {not @server.running?}
  @status = 'stopped'
end