Exception: Capybara::Poltergeist::JavascriptError

Inherits:
ClientError show all
Defined in:
lib/capybara/poltergeist/errors.rb

Instance Attribute Summary

Attributes inherited from ClientError

#response

Instance Method Summary collapse

Methods inherited from ClientError

#initialize

Constructor Details

This class inherits a constructor from Capybara::Poltergeist::ClientError

Instance Method Details

#javascript_errorsObject


44
45
46
# File 'lib/capybara/poltergeist/errors.rb', line 44

def javascript_errors
  response['args'].first.map { |data| JSErrorItem.new(data['message'], data['stack']) }
end

#messageObject


48
49
50
51
52
53
54
# File 'lib/capybara/poltergeist/errors.rb', line 48

def message
  "One or more errors were raised in the Javascript code on the page. " \
    "If you don't care about these errors, you can ignore them by " \
    "setting js_errors: false in your Poltergeist configuration (see " \
    "documentation for details)." \
    "\n\n#{javascript_errors.map(&:to_s).join("\n")}"
end