Exception: Ferrum::NoWebSocketUrlError

Inherits:
Error
  • Object
show all
Defined in:
lib/ferrum/errors.rb,
sig/ferrum/errors.rbs

Overview

Raised when connecting to an already running browser, but its /json/version endpoint doesn't answer with the websocket url.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, status = nil) ⇒ NoWebSocketUrlError

Returns a new instance of NoWebSocketUrlError.

Parameters:

  • url (String)
  • status (String, nil) (defaults to: nil)


182
183
184
185
186
187
188
# File 'lib/ferrum/errors.rb', line 182

def initialize(url, status = nil)
  @url = url
  @status = status
  reason = status ? "answered #{status}" : "didn't answer with JSON"
  super("Couldn't get a websocket url out of #{url}, `/json/version` there #{reason}. " \
        "Check the browser is reachable at that url and that any credentials it needs are part of it")
end

Instance Attribute Details

#status ⇒ String? (readonly)

Returns the value of attribute status.

Returns:

  • (String, nil)


180
181
182
# File 'lib/ferrum/errors.rb', line 180

def status
  @status
end

#url ⇒ String (readonly)

Returns the value of attribute url.

Returns:

  • (String)


180
181
182
# File 'lib/ferrum/errors.rb', line 180

def url
  @url
end