Class: SGrid::RemoteControl
- Inherits:
-
Object
- Object
- SGrid::RemoteControl
- Defined in:
- lib/selenium-grid/lib/ruby/s_grid/remote_control.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ RemoteControl
constructor
A new instance of RemoteControl.
- #rc_args(options) ⇒ Object
- #shutdown ⇒ Object
- #start(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RemoteControl
Returns a new instance of RemoteControl.
5 6 7 8 9 10 |
# File 'lib/selenium-grid/lib/ruby/s_grid/remote_control.rb', line 5 def initialize(={}) @host = [:host] || "localhost" @port = ([:port] || "4444").to_i @hub_url = [:hub_url] || "http://localhost:4444" @shutdown_command = [:shutdown_command] || "shutDownSeleniumServer" end |
Instance Method Details
#rc_args(options) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/selenium-grid/lib/ruby/s_grid/remote_control.rb', line 28 def rc_args() args = [] args << "-host" << @host args << "-port" << @port args << "-hubUrl" << @hub_url args << %Q{-env "#{[:environment] || ENV['ENVIRONMENT'] || '*firefox'}"} args << ([:selenium_args] || ENV['SELENIUM_ARGS'] || "") args end |
#shutdown ⇒ Object
23 24 25 26 |
# File 'lib/selenium-grid/lib/ruby/s_grid/remote_control.rb', line 23 def shutdown http = Net::HTTP.new(@host, @port) http.post('/selenium-server/driver/', "cmd=#{@shutdown_command}") end |
#start(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/selenium-grid/lib/ruby/s_grid/remote_control.rb', line 12 def start(={}) # Selenium Server must be first in classpath root = File.(File.dirname(__FILE__) + "/../../..") classpath = Java::Classpath.new(root) classpath = classpath << "." << "vendor/selenium-server-*.jar" classpath = classpath << "lib/selenium-grid-remote-control-standalone-*.jar" Java::VM.new.run "com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControlLauncher", .merge(:classpath => classpath.definition, :args => rc_args()) end |