Class: Selenium::WebDriver::Remote::Response Private

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/remote/response.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, payload = nil) ⇒ Response

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Response.

API:

  • private



11
12
13
14
15
16
# File 'lib/selenium/webdriver/remote/response.rb', line 11

def initialize(code, payload = nil)
  @code    = code
  @payload = payload || {}

  assert_ok
end

Instance Attribute Details

#codeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



8
9
10
# File 'lib/selenium/webdriver/remote/response.rb', line 8

def code
  @code
end

#payloadObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



8
9
10
# File 'lib/selenium/webdriver/remote/response.rb', line 8

def payload
  @payload
end

Instance Method Details

#[](key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



37
38
39
# File 'lib/selenium/webdriver/remote/response.rb', line 37

def [](key)
  @payload[key]
end

#errorObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



18
19
20
21
22
23
24
25
26
# File 'lib/selenium/webdriver/remote/response.rb', line 18

def error
  klass = Error.for_code(@payload['status']) || return

  ex = klass.new(error_message)
  ex.set_backtrace(caller)
  add_backtrace ex

  ex
end

#error_messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



28
29
30
31
32
33
34
35
# File 'lib/selenium/webdriver/remote/response.rb', line 28

def error_message
  val = @payload['value']
  msg = val['message'] or return ""

  msg << " (#{ val['class'] })" if val['class']

  msg
end