Class: Selenium::Rake::RemoteControlStopTask

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

Overview

Rake task to stop a Selenium Remote Control Server

Selenium::Rake::RemoteControlStopTask.new do |rc|

rc.host = "localhost"
rc.port = 4444
rc.timeout_in_seconds = 3 * 60

end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :'selenium:rc:stop') {|_self| ... } ⇒ RemoteControlStopTask

Returns a new instance of RemoteControlStopTask.

Yields:

  • (_self)

Yield Parameters:


16
17
18
19
20
21
22
23
24
25
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 16

def initialize(name = :'selenium:rc:stop')
  @host = "localhost"
  @name = name
  @port = 4444
  @timeout_in_seconds = nil
  @shutdown_command = nil
  @wait_until_stopped = true
  yield self if block_given?
  define
end

Instance Attribute Details

#hostObject

Returns the value of attribute host


13
14
15
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 13

def host
  @host
end

#portObject

Returns the value of attribute port


13
14
15
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 13

def port
  @port
end

#shutdown_commandObject

Returns the value of attribute shutdown_command


13
14
15
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 13

def shutdown_command
  @shutdown_command
end

#timeout_in_secondsObject

Returns the value of attribute timeout_in_seconds


13
14
15
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 13

def timeout_in_seconds
  @timeout_in_seconds
end

#wait_until_stoppedObject

Returns the value of attribute wait_until_stopped


13
14
15
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 13

def wait_until_stopped
  @wait_until_stopped
end

Instance Method Details

#defineObject


27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/selenium/rake/remote_control_stop_task.rb', line 27

def define
  desc "Stop Selenium Remote Control running"
  task @name do
    puts "Stopping Selenium Remote Control running at #{host}:#{port}..."
    remote_control = Selenium::RemoteControl::RemoteControl.new(
        host, port, :timeout => timeout_in_seconds,
        :shutdown_command => shutdown_command)
    remote_control.stop
    if @wait_until_stopped
      TCPSocket.wait_for_service_termination :host => host, :port => port
    end
    puts "Stopped Selenium Remote Control running at #{host}:#{port}"
  end
end