### Home Classes Methods

### In Files

- lib/selenium/webdriver/remote/capabilities.rb

### Parent

Object

### Methods

- ::android
- ::chrome
- ::firefox
- ::htmlunit
- ::ie
- ::internet_explorer
- ::ipad
- ::iphone
- ::json_create
- ::new
- ::opera
- ::phantomjs
- ::safari
- #==
- #[]
- #[]=
- #as_json
- #capabilities
- #eql?
- #merge!
- #proxy=
- #to_json

### Class/Module Index

Quicksearch

- Selenium
- Selenium::Client
- Selenium::Client::Base
- Selenium::Client::CommandError
- Selenium::Client::Driver
- Selenium::Client::Extensions
- Selenium::Client::GeneratedDriver
- Selenium::Client::Idiomatic
- Selenium::Client::JavascriptExpressionBuilder
- Selenium::Client::JavascriptFrameworks
- Selenium::Client::JavascriptFrameworks::JQuery
- Selenium::Client::JavascriptFrameworks::Prototype
- Selenium::Client::Protocol
- Selenium::Client::ProtocolError
- Selenium::Client::SeleniumHelper
- Selenium::Rake
- Selenium::Rake::MissingJarFileError
- Selenium::Rake::ServerTask
- Selenium::Server
- Selenium::Server::Error
- Selenium::WebDriver
- Selenium::WebDriver::ActionBuilder
- Selenium::WebDriver::Alert
- Selenium::WebDriver::Android
- Selenium::WebDriver::Android::Bridge
- Selenium::WebDriver::BridgeHelper
- Selenium::WebDriver::Chrome
- Selenium::WebDriver::Chrome::Bridge
- Selenium::WebDriver::Chrome::Profile
- Selenium::WebDriver::Chrome::Service
- Selenium::WebDriver::Driver
- Selenium::WebDriver::DriverExtensions
- Selenium::WebDriver::DriverExtensions::HasBrowserConnection
- Selenium::WebDriver::DriverExtensions::HasInputDevices
- Selenium::WebDriver::DriverExtensions::HasLocation
- Selenium::WebDriver::DriverExtensions::HasSessionId
- Selenium::WebDriver::DriverExtensions::HasTouchScreen
- Selenium::WebDriver::DriverExtensions::HasWebStorage
- Selenium::WebDriver::DriverExtensions::Rotatable
- Selenium::WebDriver::DriverExtensions::TakesScreenshot
- Selenium::WebDriver::DriverExtensions::UploadsFiles
- Selenium::WebDriver::Element
- Selenium::WebDriver::Error
- Selenium::WebDriver::Error::ElementNotDisplayedError
- Selenium::WebDriver::Error::ElementNotSelectableError
- Selenium::WebDriver::Error::ElementNotVisibleError
- Selenium::WebDriver::Error::ExpectedError
- Selenium::WebDriver::Error::IMEEngineActivationFailedError
- Selenium::WebDriver::Error::IMENotAvailableError
- Selenium::WebDriver::Error::IndexOutOfBoundsError
- Selenium::WebDriver::Error::InvalidCookieDomainError
- Selenium::WebDriver::Error::InvalidElementCoordinatesError
- Selenium::WebDriver::Error::InvalidElementStateError
- Selenium::WebDriver::Error::InvalidSelectorError
- Selenium::WebDriver::Error::JavascriptError
- Selenium::WebDriver::Error::MoveTargetOutOfBoundsError
- Selenium::WebDriver::Error::NoAlertOpenError
- Selenium::WebDriver::Error::NoAlertPresentError
- Selenium::WebDriver::Error::NoCollectionError
- Selenium::WebDriver::Error::NoScriptResultError
- Selenium::WebDriver::Error::NoStringError
- Selenium::WebDriver::Error::NoStringLengthError
- Selenium::WebDriver::Error::NoStringWrapperError
- Selenium::WebDriver::Error::NoSuchCollectionError
- Selenium::WebDriver::Error::NoSuchDocumentError
- Selenium::WebDriver::Error::NoSuchDriverError
- Selenium::WebDriver::Error::NoSuchElementError
- Selenium::WebDriver::Error::NoSuchFrameError
- Selenium::WebDriver::Error::NoSuchWindowError
- Selenium::WebDriver::Error::NullPointerError
- Selenium::WebDriver::Error::ObsoleteElementError
- Selenium::WebDriver::Error::ScriptTimeOutError
- Selenium::WebDriver::Error::ServerError
- Selenium::WebDriver::Error::StaleElementReferenceError
- Selenium::WebDriver::Error::TimeOutError
- Selenium::WebDriver::Error::UnableToSetCookieError
- Selenium::WebDriver::Error::UnexpectedJavascriptError
- Selenium::WebDriver::Error::UnhandledAlertError
- Selenium::WebDriver::Error::UnhandledError
- Selenium::WebDriver::Error::UnknownCommandError
- Selenium::WebDriver::Error::UnknownError
- Selenium::WebDriver::Error::UnsupportedOperationError
- Selenium::WebDriver::Error::WebDriverError
- Selenium::WebDriver::Error::XPathLookupError
- Selenium::WebDriver::FileReaper
- Selenium::WebDriver::Firefox
- Selenium::WebDriver::Firefox::Binary
- Selenium::WebDriver::Firefox::Bridge
- Selenium::WebDriver::Firefox::Extension
- Selenium::WebDriver::Firefox::Launcher
- Selenium::WebDriver::Firefox::Profile
- Selenium::WebDriver::Firefox::ProfilesIni
- Selenium::WebDriver::Firefox::SocketLock
- Selenium::WebDriver::Firefox::Util
- Selenium::WebDriver::HTML5
- Selenium::WebDriver::HTML5::LocalStorage
- Selenium::WebDriver::HTML5::SessionStorage
- Selenium::WebDriver::HTML5::SharedWebStorage
- Selenium::WebDriver::IE
- Selenium::WebDriver::IE::Bridge
- Selenium::WebDriver::IE::Server
- Selenium::WebDriver::IPhone
- Selenium::WebDriver::IPhone::Bridge
- Selenium::WebDriver::JsonHelper
- Selenium::WebDriver::Keyboard
- Selenium::WebDriver::Keys
- Selenium::WebDriver::LogEntry
- Selenium::WebDriver::Mouse
- Selenium::WebDriver::Navigation
- Selenium::WebDriver::Opera
- Selenium::WebDriver::Opera::Bridge
- Selenium::WebDriver::Opera::Service
- Selenium::WebDriver::Options
- Selenium::WebDriver::PhantomJS
- Selenium::WebDriver::PhantomJS::Bridge
- Selenium::WebDriver::PhantomJS::Service
- Selenium::WebDriver::Platform
- Selenium::WebDriver::PortProber
- Selenium::WebDriver::ProfileHelper
- Selenium::WebDriver::ProfileHelper::ClassMethods
- Selenium::WebDriver::Proxy
- Selenium::WebDriver::Remote
- Selenium::WebDriver::Remote::Bridge
- Selenium::WebDriver::Remote::Capabilities
- Selenium::WebDriver::Remote::Http
- Selenium::WebDriver::Remote::Http::Common
- Selenium::WebDriver::Remote::Http::Curb
- Selenium::WebDriver::Remote::Http::Default
- Selenium::WebDriver::Remote::Http::Persistent
- Selenium::WebDriver::Remote::Response
- Selenium::WebDriver::Safari
- Selenium::WebDriver::Safari::Bridge
- Selenium::WebDriver::Safari::Browser
- Selenium::WebDriver::Safari::Extension
- Selenium::WebDriver::Safari::Server
- Selenium::WebDriver::SearchContext
- Selenium::WebDriver::SocketPoller
- Selenium::WebDriver::Support
- Selenium::WebDriver::Support::AbstractEventListener
- Selenium::WebDriver::Support::BlockEventListener
- Selenium::WebDriver::Support::Color
- Selenium::WebDriver::Support::EventFiringBridge
- Selenium::WebDriver::Support::Select
- Selenium::WebDriver::Support::Select::Escaper
- Selenium::WebDriver::TargetLocator
- Selenium::WebDriver::Timeouts
- Selenium::WebDriver::TouchActionBuilder
- Selenium::WebDriver::TouchScreen
- Selenium::WebDriver::Wait
- Selenium::WebDriver::Window
- Selenium::WebDriver::Zipper
- Base64
- Dir
- SocketError
- String

No matching classes.

# Selenium::WebDriver::Remote::Capabilities

Specification of the desired and/or actual capabilities of the browser that the server is being asked to create.

### Constants

DEFAULTS

### Public Class Methods

android(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 44
    def android(opts = {})
      new({
        :browser_name     => "android",
        :platform         => :android,
        :rotatable        => true,
        :takes_screenshot => true
      }.merge(opts))
    end

chrome(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 53
    def chrome(opts = {})
      new({
        :browser_name          => "chrome",
        :javascript_enabled    => true,
        :css_selectors_enabled => true
      }.merge(opts))
    end

firefox(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 61
    def firefox(opts = {})
      new({
        :browser_name          => "firefox",
        :javascript_enabled    => true,
        :takes_screenshot      => true,
        :css_selectors_enabled => true
      }.merge(opts))
    end

htmlunit(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 70
    def htmlunit(opts = {})
      new({
        :browser_name => "htmlunit"
      }.merge(opts))
    end

ie(opts = {}) click to toggle source
Alias for: internet_explorer
internet_explorer(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 76
    def internet_explorer(opts = {})
      new({
        :browser_name          => "internet explorer",
        :platform              => :windows,
        :takes_screenshot      => true,
        :css_selectors_enabled => true
      }.merge(opts))
    end

Also aliased as: ie
ipad(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 94
    def ipad(opts = {})
      new({
        :browser_name       => "iPad",
        :platform           => :mac,
        :javascript_enabled => true
      }.merge(opts))
    end

iphone(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 86
    def iphone(opts = {})
      new({
        :browser_name       => "iPhone",
        :platform           => :mac,
        :javascript_enabled => true
      }.merge(opts))
    end

json_create(data) click to toggle source

@api private

    # File lib/selenium/webdriver/remote/capabilities.rb, line 133
    def json_create(data)
      data = data.dup

      caps = new
      caps.browser_name          = data.delete("browserName")
      caps.version               = data.delete("version")
      caps.platform              = data.delete("platform").downcase.to_sym if data.has_key?('platform')
      caps.javascript_enabled    = data.delete("javascriptEnabled")
      caps.css_selectors_enabled = data.delete("cssSelectorsEnabled")
      caps.takes_screenshot      = data.delete("takesScreenshot")
      caps.native_events         = data.delete("nativeEvents")
      caps.rotatable             = data.delete("rotatable")
      caps.proxy                 = Proxy.json_create(data['proxy']) if data.has_key?('proxy')

      # any remaining pairs will be added as is, with no conversion
      caps.merge!(data)

      caps
    end

new(opts = {}) click to toggle source

@option :browser_name [String] required browser name @option :version [String] required browser version number @option :platform [Symbol] one of :any, :win, :mac, or :x @option :javascript_enabled [Boolean] does the driver have javascript enabled? @option :css_selectors_enabled [Boolean] does the driver support CSS selectors? @option :takes_screenshot [Boolean] can this driver take screenshots? @option :native_events [Boolean] does this driver use native events? @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration

Firefox-specific options:

@option :firefox_profile [Selenium::WebDriver::Firefox::Profile] the firefox profile to use

@api public

    # File lib/selenium/webdriver/remote/capabilities.rb, line 170
    def initialize(opts = {})
      @capabilities = DEFAULTS.merge(opts)
      self.proxy    = opts.delete(:proxy)
    end

opera(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 102
    def opera(opts = {})
      new({
        :browser_name          => "opera",
        :javascript_enabled    => true,
        :takes_screenshot      => true,
        :css_selectors_enabled => true
      }.merge(opts))
    end

phantomjs(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 111
    def phantomjs(opts = {})
      new({
        :browser_name          => "phantomjs",
        :javascript_enabled    => true,
        :takes_screenshot      => true,
        :css_selectors_enabled => true
      }.merge(opts))
    end

safari(opts = {}) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 120
    def safari(opts = {})
      new({
        :browser_name          => "safari",
        :javascript_enabled    => true,
        :takes_screenshot      => true,
        :css_selectors_enabled => true
      }.merge(opts))
    end

### Public Instance Methods

==(other) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 238
    def ==(other)
      return false unless other.kind_of? self.class
      as_json == other.as_json
    end

Also aliased as: eql?
[](key) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 183
    def [](key)
      @capabilities[key]
    end

[]=(key, value) click to toggle source

Allows setting arbitrary capabilities.

    # File lib/selenium/webdriver/remote/capabilities.rb, line 179
    def []=(key, value)
      @capabilities[key] = value
    end

as_json(opts = nil) click to toggle source

@api private

    # File lib/selenium/webdriver/remote/capabilities.rb, line 211
    def as_json(opts = nil)
      hash = {}

      @capabilities.each do |key, value|
        case key
        when :platform
          hash['platform'] = value.to_s.upcase
        when :firefox_profile
          hash['firefox_profile'] = value.as_json['zip'] if value
        when :proxy
          hash['proxy'] = value.as_json if value
        when String, :firefox_binary
          hash[key.to_s] = value
        when Symbol
          hash[camel_case(key.to_s)] = value
        else
          raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
        end
      end

      hash
    end

eql?(other) click to toggle source
Alias for: ==
merge!(other) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 187
    def merge!(other)
      if other.respond_to?(:capabilities) && other.capabilities.kind_of?(Hash)
        @capabilities.merge! other.capabilities
      elsif other.kind_of? Hash
        @capabilities.merge! other
      else
        raise ArgumentError, "argument should be a Hash or implement #capabilities"
      end
    end

proxy=(proxy) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 197
    def proxy=(proxy)
      case proxy
      when Hash
        @capabilities[:proxy] = Proxy.new(proxy)
      when Proxy, nil
        @capabilities[:proxy] = proxy
      else
        raise TypeError, "expected Hash or #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
      end
    end

to_json(*args) click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 234
    def to_json(*args)
      WebDriver.json_dump as_json
    end

### Protected Instance Methods

capabilities() click to toggle source

    # File lib/selenium/webdriver/remote/capabilities.rb, line 246
    def capabilities
      @capabilities
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.