Sha256: 2fca414143f415ed817390c0a2f0778b501e9dce586ad028ab5bbd83ddd960ea

Contents?: true

Size: 801 Bytes

Versions: 12

Compression:

Stored size: 801 Bytes

Contents

module Selenium
  module WebDriver
    module Remote
      class Response

        attr_accessor :code
        attr_writer   :payload

        def initialize
          yield self if block_given?
          assert_ok
        end

        def error
          if payload['error']
            JSON.parse(payload['value'])
          end
        end

        def [](key)
          payload[key]
        end

        def payload
          @payload ||= {}
        end

        private

        def assert_ok
          if @code.nil? || @code > 400
            if e = error()
              raise Error.for_remote_class(e['class']), e['message']
            else
              raise ServerError, self
            end
          end
        end

      end # Response
    end # Remote
  end # WebDriver
end # Selenium

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
selenium-webdriver-0.0.12 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.11 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.10 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.9 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.8 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.7 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.6 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.5 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.4 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.3 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.2 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb
selenium-webdriver-0.0.1 remote/client/src/rb/lib/selenium/webdriver/remote/response.rb