Class: Selenium::WebDriver::Remote::Response Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Remote::Response
- Defined in:
- 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
- #code ⇒ Object readonly private
- #payload ⇒ Object private
Instance Method Summary collapse
- #[](key) ⇒ Object private
- #error ⇒ Object private
- #error_message ⇒ Object private
-
#initialize(code, payload = nil) ⇒ Response
constructor
private
A new instance of Response.
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.
30 31 32 33 34 35 |
# File 'lib/selenium/webdriver/remote/response.rb', line 30 def initialize(code, payload = nil) @code = code @payload = payload || {} assert_ok end |
Instance Attribute Details
#code ⇒ Object (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.
27 28 29 |
# File 'lib/selenium/webdriver/remote/response.rb', line 27 def code @code end |
#payload ⇒ 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.
27 28 29 |
# File 'lib/selenium/webdriver/remote/response.rb', line 27 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.
64 65 66 |
# File 'lib/selenium/webdriver/remote/response.rb', line 64 def [](key) @payload[key] end |
#error ⇒ 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.
37 38 39 40 41 42 43 44 45 |
# File 'lib/selenium/webdriver/remote/response.rb', line 37 def error klass = Error.for_code(status) || return ex = klass.new() ex.set_backtrace(caller) add_backtrace ex ex end |
#error_message ⇒ 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.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/selenium/webdriver/remote/response.rb', line 47 def val = value case val when Hash msg = val['message'] or return "unknown error" msg << ": #{val['alert']['text'].inspect}" if val['alert'].kind_of?(Hash) && val['alert']['text'] msg << " (#{ val['class'] })" if val['class'] when String msg = val else msg = "unknown error, status=#{status}: #{val.inspect}" end msg end |