Sha256: ee70d80815453d4e6b71d80cf1bc2b28faea236679422bf3cb4c833b156fe610

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

module Selenium
  module WebDriver
    module IE

      #
      # @api private
      #

      class InProcessServer
        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

7 entries across 7 versions & 1 rubygems

Version Path
selenium-webdriver-2.22.2 lib/selenium/webdriver/ie/in_process_server.rb
selenium-webdriver-2.22.2.rc2 lib/selenium/webdriver/ie/in_process_server.rb
selenium-webdriver-2.22.2.rc1 lib/selenium/webdriver/ie/in_process_server.rb
selenium-webdriver-2.22.1 lib/selenium/webdriver/ie/in_process_server.rb
selenium-webdriver-2.22.0 lib/selenium/webdriver/ie/in_process_server.rb
selenium-webdriver-2.22.0.rc3 lib/selenium/webdriver/ie/in_process_server.rb
selenium-webdriver-2.22.0.rc2 lib/selenium/webdriver/ie/in_process_server.rb