Class: Selenium::Rake::ServerTask
- Inherits:
-
Object
- Object
- Selenium::Rake::ServerTask
- Includes:
- Rake::DSL
- Defined in:
- lib/selenium/rake/server_task.rb
Overview
Defines rake tasks for starting, stopping and restarting the Selenium server.
Usage:
require 'selenium/rake/server_task'
Selenium::Rake::ServerTask.new do |t|
t.jar = "/path/to/selenium-server-standalone.jar"
t.port = 4444
t.opts = %w[-some options]
end
Alternatively, you can have the task download a specific version of the server:
Selenium::Rake::ServerTask.new(:server) do |t|
t.version = '2.6.0'
end
or the latest version
Selenium::Rake::ServerTask.new(:server) do |t|
t.version = :latest
end
Tasks defined:
rake selenium:server:start
rake selenium:server:stop
rake selenium:server:restart
Instance Attribute Summary collapse
-
#background ⇒ Object
(also: #background?)
Whether we should detach from the server process.
-
#jar ⇒ Object
Path to the selenium server jar.
-
#log ⇒ Object
Configure logging.
-
#opts ⇒ Object
Add additional options passed to the server jar.
-
#port ⇒ Object
Port to use for the server.
-
#timeout ⇒ Object
Timeout in seconds for the server to start/stop.
-
#version ⇒ Object
Specify the version of the server jar to download.
Instance Method Summary collapse
-
#initialize(prefix = "selenium:server") {|_self| ... } ⇒ ServerTask
constructor
A new instance of ServerTask.
Constructor Details
#initialize(prefix = "selenium:server") {|_self| ... } ⇒ ServerTask
Returns a new instance of ServerTask.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/selenium/rake/server_task.rb', line 99 def initialize(prefix = "selenium:server") @jar = nil @prefix = prefix @port = 4444 @timeout = 30 @background = true @log = true @opts = [] @version = nil yield self if block_given? if @version @jar = Selenium::Server.download(@version) end unless @jar raise MissingJarFileError, "must provide path to the selenium server jar" end @server = Selenium::Server.new(@jar, :port => @port, :timeout => @timeout, :background => @background, :log => @log ) @server << @opts define_start_task define_stop_task define_restart_task end |
Instance Attribute Details
#background ⇒ Object Also known as: background?
Whether we should detach from the server process. Default: true
72 73 74 |
# File 'lib/selenium/rake/server_task.rb', line 72 def background @background end |
#jar ⇒ Object
Path to the selenium server jar
50 51 52 |
# File 'lib/selenium/rake/server_task.rb', line 50 def jar @jar end |
#log ⇒ Object
Configure logging. Pass a log file path or a boolean. Default: true
true - log to stdout/stderr false - no logging String - log to the specified file
84 85 86 |
# File 'lib/selenium/rake/server_task.rb', line 84 def log @log end |
#opts ⇒ Object
Add additional options passed to the server jar.
90 91 92 |
# File 'lib/selenium/rake/server_task.rb', line 90 def opts @opts end |
#port ⇒ Object
Port to use for the server. Default: 4444
58 59 60 |
# File 'lib/selenium/rake/server_task.rb', line 58 def port @port end |
#timeout ⇒ Object
Timeout in seconds for the server to start/stop. Default: 30
65 66 67 |
# File 'lib/selenium/rake/server_task.rb', line 65 def timeout @timeout end |
#version ⇒ Object
Specify the version of the server jar to download
96 97 98 |
# File 'lib/selenium/rake/server_task.rb', line 96 def version @version end |