Sha256: 40db00b770168f4e5ffd18efe4aefbd27c0c8a884b8267d28e01674e0c9bb071

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

module Selenium
  module WebDriver
    module Opera

      #
      # @api private
      #

      class Service
        MISSING_TEXT = 'Unable to find the Selenium server jar.  Please download the standalone server from http://code.google.com/p/selenium/downloads/list and set the SELENIUM_SERVER_JAR environmental variable to its location.  More info at http://code.google.com/p/selenium/wiki/OperaDriver.'

        def self.selenium_server_jar
          @selenium_server_jar ||= (
            ENV['SELENIUM_SERVER_JAR'] or raise Error::WebDriverError, MISSING_TEXT
          )
        end

        def self.selenium_server_jar=(path)
          Platform.assert_file path
          @selenium_server_jar = path
        end

        def self.default_service
          new selenium_server_jar
        end

        def initialize(jar, opts = {})
          opts.merge! :background => true, :port => PortProber.random, :log => !!$DEBUG
          @server = Selenium::Server.new File.expand_path(jar), opts
        end

        def uri
          @server.webdriver_url
        end

        def start
          @server.start
          Platform.exit_hook { stop }  # make sure we don't leave the server running
        end

        def stop
          @server.stop
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
selenium-webdriver-2.5.0 lib/selenium/webdriver/opera/service.rb
selenium-webdriver-2.4.0 lib/selenium/webdriver/opera/service.rb
selenium-webdriver-2.3.2 lib/selenium/webdriver/opera/service.rb
selenium-webdriver-2.3.0 lib/selenium/webdriver/opera/service.rb
selenium-webdriver-2.2.0 lib/selenium/webdriver/opera/service.rb
selenium-webdriver-2.1.0 lib/selenium/webdriver/opera/service.rb
selenium-webdriver-2.0.1 lib/selenium/webdriver/opera/service.rb