Sha256: 1c7595997a678fb5b887db3fbd4261e136023c388958e5685195e2019bcfc56a

Contents?: true

Size: 1.57 KB

Versions: 25

Compression:

Stored size: 1.57 KB

Contents

module Selenium
  module WebDriver
    module Firefox

      # @api private
      class Bridge < Remote::Bridge

        def initialize(opts = {})
          port        = opts.delete(:port) || DEFAULT_PORT
          profile     = opts.delete(:profile)
          http_client = opts.delete(:http_client)
          proxy       = opts.delete(:proxy)

          caps = opts.delete(:desired_capabilities) do
            Remote::Capabilities.firefox(:native_events => DEFAULT_ENABLE_NATIVE_EVENTS)
          end

          @launcher = create_launcher(port, profile)

          unless opts.empty?
            raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
          end

          @launcher.launch

          caps.proxy = proxy if proxy

          remote_opts = {
            :url                  => @launcher.url,
            :desired_capabilities => caps
          }

          remote_opts.merge!(:http_client => http_client) if http_client

          begin
            super(remote_opts)
          rescue
            @launcher.quit
            raise
          end
        end

        def browser
          :firefox
        end

        def driver_extensions
          [
            DriverExtensions::TakesScreenshot,
            DriverExtensions::HasInputDevices
          ]
        end

        def quit
          super
          nil
        ensure
          @launcher.quit
        end

        private

        def create_launcher(port, profile)
          Launcher.new Binary.new, port, profile
        end

      end # Bridge
    end # Firefox
  end # WebDriver
end # Selenium

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
selenium-webdriver-2.45.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.45.0.dev3 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.45.0.dev2 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.45.0.dev lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.44.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.44.0.dev lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.43.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.42.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.41.0 lib/selenium/webdriver/firefox/bridge.rb
browserstack-webdriver-2.40.1 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.40.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.40.0.rc2 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.40.0.rc1 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.39.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.38.0 lib/selenium/webdriver/firefox/bridge.rb
browserstack-webdriver-0.0.22 lib/selenium/webdriver/firefox/bridge.rb
browserstack-webdriver-0.0.1 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.37.0 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.35.1 lib/selenium/webdriver/firefox/bridge.rb
selenium-webdriver-2.35.0 lib/selenium/webdriver/firefox/bridge.rb