Sha256: 6cefafea87d3941969a0e05e453fd1f03a2be988815a605c11b37140fd188c01

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

module Selenium
  module RemoteControl
    
    class RemoteControl
      attr_reader :host, :port, :timeout_in_seconds, :firefox_profile, :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"
        @firefox_profile = options[:firefox_profile]
        @additional_args = options[:additional_args] || []
        @shell = Nautilus::Shell.new
      end
      
      def start(options = {})
        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 => options[:background]}
      end
      
      def stop
        Net::HTTP.get(@host, "/selenium-server/driver/?cmd=#{shutdown_command}", @port)
      end
      
    end
    
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
selenium-selenese-1.1.13 lib/selenium/remote_control/remote_control.rb
selenium-selenese-1.1.12 lib/selenium/remote_control/remote_control.rb
selenium-selenese-1.1.11 lib/selenium/remote_control/remote_control.rb
selenium-selenese-1.1.10 lib/selenium/remote_control/remote_control.rb
selenium-selenese-1.1.6 lib/selenium/remote_control/remote_control.rb
selenium-selenese-1.1.4 lib/selenium/remote_control/remote_control.rb
selenium-selenese-1.1.3 lib/selenium/remote_control/remote_control.rb
selenium-client-1.2.18 lib/selenium/remote_control/remote_control.rb