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.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/selenium/rake/server_task.rb', line 118 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
91 92 93 |
# File 'lib/selenium/rake/server_task.rb', line 91 def background @background end |
#jar ⇒ Object
Path to the selenium server jar
69 70 71 |
# File 'lib/selenium/rake/server_task.rb', line 69 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
103 104 105 |
# File 'lib/selenium/rake/server_task.rb', line 103 def log @log end |
#opts ⇒ Object
Add additional options passed to the server jar.
109 110 111 |
# File 'lib/selenium/rake/server_task.rb', line 109 def opts @opts end |
#port ⇒ Object
Port to use for the server. Default: 4444
77 78 79 |
# File 'lib/selenium/rake/server_task.rb', line 77 def port @port end |
#timeout ⇒ Object
Timeout in seconds for the server to start/stop. Default: 30
84 85 86 |
# File 'lib/selenium/rake/server_task.rb', line 84 def timeout @timeout end |
#version ⇒ Object
Specify the version of the server jar to download
115 116 117 |
# File 'lib/selenium/rake/server_task.rb', line 115 def version @version end |