Class: Selenium::RemoteControl::RemoteControl
- Inherits:
-
Object
- Object
- Selenium::RemoteControl::RemoteControl
- Defined in:
- lib/selenium/remote_control/remote_control.rb
Instance Attribute Summary collapse
-
#additional_args ⇒ Object
Returns the value of attribute additional_args.
-
#firefox_profile ⇒ Object
readonly
Returns the value of attribute firefox_profile.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#jar_file ⇒ Object
Returns the value of attribute jar_file.
-
#log_to ⇒ Object
Returns the value of attribute log_to.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#shutdown_command ⇒ Object
readonly
Returns the value of attribute shutdown_command.
-
#timeout_in_seconds ⇒ Object
readonly
Returns the value of attribute timeout_in_seconds.
Instance Method Summary collapse
-
#initialize(host, port, options = {}) ⇒ RemoteControl
constructor
A new instance of RemoteControl.
- #start(options = {}) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(host, port, options = {}) ⇒ RemoteControl
Returns a new instance of RemoteControl.
8 9 10 11 12 13 14 15 |
# File 'lib/selenium/remote_control/remote_control.rb', line 8 def initialize(host, port, ={}) @host, @port = host, port @timeout_in_seconds = [:timeout] || (2 * 60) @shutdown_command = [:shutdown_command] || "shutDownSeleniumServer" @firefox_profile = [:firefox_profile] @additional_args = [:additional_args] || [] @shell = Nautilus::Shell.new end |
Instance Attribute Details
#additional_args ⇒ Object
Returns the value of attribute additional_args.
6 7 8 |
# File 'lib/selenium/remote_control/remote_control.rb', line 6 def additional_args @additional_args end |
#firefox_profile ⇒ Object (readonly)
Returns the value of attribute firefox_profile.
5 6 7 |
# File 'lib/selenium/remote_control/remote_control.rb', line 5 def firefox_profile @firefox_profile end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/selenium/remote_control/remote_control.rb', line 5 def host @host end |
#jar_file ⇒ Object
Returns the value of attribute jar_file.
6 7 8 |
# File 'lib/selenium/remote_control/remote_control.rb', line 6 def jar_file @jar_file end |
#log_to ⇒ Object
Returns the value of attribute log_to.
6 7 8 |
# File 'lib/selenium/remote_control/remote_control.rb', line 6 def log_to @log_to end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/selenium/remote_control/remote_control.rb', line 5 def port @port end |
#shutdown_command ⇒ Object (readonly)
Returns the value of attribute shutdown_command.
5 6 7 |
# File 'lib/selenium/remote_control/remote_control.rb', line 5 def shutdown_command @shutdown_command end |
#timeout_in_seconds ⇒ Object (readonly)
Returns the value of attribute timeout_in_seconds.
5 6 7 |
# File 'lib/selenium/remote_control/remote_control.rb', line 5 def timeout_in_seconds @timeout_in_seconds end |
Instance Method Details
#start(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/selenium/remote_control/remote_control.rb', line 17 def start( = {}) command = "java -jar \"#{jar_file}\"" command << " -port #{@port}" command << " -timeout #{@timeout_in_seconds}" command << " -firefoxProfileTemplate '#{@firefox_profile}'" if @firefox_profile command << " #{additional_args.join(' ')}" unless additional_args.empty? command << " > #{log_to}" if log_to @shell.run command, {:background => [:background]} end |
#stop ⇒ Object
28 29 30 |
# File 'lib/selenium/remote_control/remote_control.rb', line 28 def stop Net::HTTP.get(@host, "/selenium-server/driver/?cmd=#{shutdown_command}", @port) end |