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

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

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.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Response) initialize(code, payload = nil)

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



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

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

  assert_ok
end

Instance Attribute Details

- (Object) code (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.



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

def code
  @code
end

- (Object) payload

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.



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

def payload
  @payload
end

Instance Method Details

- (Object) [](key)

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.



44
45
46
# File 'rb/lib/selenium/webdriver/remote/response.rb', line 44

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

- (Object) error

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.



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

def error
  klass = Error.for_code(status) || return

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

  ex
end

- (Object) error_message

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.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'rb/lib/selenium/webdriver/remote/response.rb', line 28

def error_message
  val = value

  case val
  when Hash
    msg = val['message'] or return "unknown error"
    msg << " (#{ val['class'] })" if val['class']
  when String
    msg = val
  else
    msg = "unknown error, status=#{status}: #{val.inspect}"
  end

  msg
end