Exception: Capybara::Lightpanda::MouseEventFailed

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

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.



71
72
73
74
75
76
77
78
# File 'lib/capybara/lightpanda/errors.rb', line 71

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.



67
68
69
# File 'lib/capybara/lightpanda/errors.rb', line 67

def node
  @node
end

#positionObject (readonly)

Returns the value of attribute position.



67
68
69
# File 'lib/capybara/lightpanda/errors.rb', line 67

def position
  @position
end

#selectorObject (readonly)

Returns the value of attribute selector.



67
68
69
# File 'lib/capybara/lightpanda/errors.rb', line 67

def selector
  @selector
end