Exception: Capybara::Lightpanda::MouseEventFailed

Inherits:
BrowserError show all
Defined in:
lib/capybara/lightpanda/errors.rb

Overview

— Cuprite/Ferrum drop-in compatibility surface — This gem never raises the three classes below (no coordinate-based mouse path, no multi-page API, no page-status tracking). They mirror the peer taxonomy (Cuprite’s MouseEventFailed, Ferrum’s NoSuchPageError/StatusError) so suites migrating from those drivers don’t NameError on rescue lists that reference them.

Constant Summary collapse

PATTERN =
/at position \((\d+),\s*(\d+)\).*selector:\s*(.+)/i

Instance Attribute Summary collapse

Attributes inherited from BrowserError

#response

Instance Method Summary collapse

Methods inherited from BrowserError

#code, #data

Constructor Details

#initialize(node, message = nil) ⇒ MouseEventFailed

Returns a new instance of MouseEventFailed.



115
116
117
118
119
120
121
122
# File 'lib/capybara/lightpanda/errors.rb', line 115

def initialize(node, message = nil)
  @node = node
  if message && (match = message.match(PATTERN))
    @position = { x: match[1].to_i, y: match[2].to_i }
    @selector = match[3]
  end
  super(message || "Failed mouse event")
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



111
112
113
# File 'lib/capybara/lightpanda/errors.rb', line 111

def node
  @node
end

#positionObject (readonly)

Returns the value of attribute position.



111
112
113
# File 'lib/capybara/lightpanda/errors.rb', line 111

def position
  @position
end

#selectorObject (readonly)

Returns the value of attribute selector.



111
112
113
# File 'lib/capybara/lightpanda/errors.rb', line 111

def selector
  @selector
end