Sha256: e199f3bd0917b9fbc95595bfd897bbcad4c67865209ed8bfbf525f60027814e3

Contents?: true

Size: 1.74 KB

Versions: 10

Compression:

Stored size: 1.74 KB

Contents

module Selenium
  module WebDriver
    module IE

      #
      # @api private
      #

      class Server
        extend FFI::Library

        if Platform.bitsize == 64
          ffi_lib WebDriver::IE::DLLS[:x64]
        else
          ffi_lib WebDriver::IE::DLLS[:win32]
        end

        ffi_convention :stdcall

        attach_function :start_server,  :StartServer,           [:int],     :pointer
        attach_function :stop_server,   :StopServer,            [:pointer], :void
        attach_function :session_count, :GetServerSessionCount, [],         :int
        attach_function :current_port,  :GetServerPort,         [],         :int
        attach_function :is_running,    :ServerIsRunning,       [],         :bool

        def initialize
          @handle = nil
        end

        #
        # Starts the server, communicating on the specified port, if it is not already running
        #

        def start(start_port, timeout)
          return port if running?
          @handle = self.class.start_server(start_port)

          unless SocketPoller.new(Platform.localhost, start_port, timeout).connected?
            raise Error::WebDriverError, "unable to connect to IE server within #{timeout} seconds"
          end

          start_port
        end

        def stop
          return if session_count != 0 || @handle.nil?
          self.class.stop_server @handle
          @handle = nil
        end

        def running?
          self.class.is_running
        end

        def port
          self.class.current_port
        end

        def uri
          "http://#{Platform.localhost}:#{port}"
        end

        private

        def session_count
          self.class.session_count
        end

      end # Server
    end # IE
  end # WebDriver
end # Selenium

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/ie/server.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/ie/server.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/ie/server.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/ie/server.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/ie/server.rb
selenium-webdriver-2.22.0.rc1 lib/selenium/webdriver/ie/server.rb
selenium-webdriver-2.21.2 lib/selenium/webdriver/ie/server.rb
selenium-webdriver-2.21.2.rc1 lib/selenium/webdriver/ie/server.rb
selenium-webdriver-2.21.1 lib/selenium/webdriver/ie/server.rb
selenium-webdriver-2.21.0 lib/selenium/webdriver/ie/server.rb