Sha256: 940f28a0686f449fc138250b7dcd5ea09aadc142ee1d5c586d35f9e3bc3b94a5

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module Selenium
  module RemoteControl
    
    class RemoteControl
      attr_reader :host, :port, :timeout_in_seconds, :shutdown_command
      attr_accessor :additional_args, :jar_file, :log_to
      
      def initialize(host, port, options={})
        @host, @port = host, port
        @timeout_in_seconds = options[:timeout] || (2 * 60)
        @shutdown_command = options[:shutdown_command] || "shutDownSeleniumServer"
        @additional_args = []
        @shell = Nautilus::Shell.new
      end
      
      def start(options = {})
        command = "java -jar \"#{jar_file}\""
        command << " -port #{@port}"
        command << " -timeout #{@timeout_in_seconds}"
        command << " #{additional_args.join(' ')}" unless additional_args.empty?
        command << " > #{log_to}" if log_to
        
        @shell.run command, {:background => options[:background]}
      end
      
      def stop
        Net::HTTP.get(@host, "/selenium-server/driver/?cmd=#{shutdown_command}", @port)
      end
      
    end
    
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
selenium-rspec-dsl-1.0.2 vendor/selenium-client-1.2.17/lib/selenium/remote_control/remote_control.rb
selenium-client-1.2.17 lib/selenium/remote_control/remote_control.rb
selenium-client-1.2.16 lib/selenium/remote_control/remote_control.rb