Exception: Capybara::Lightpanda::MouseEventFailed

Inherits:
Error
  • Object
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

Instance Method Summary collapse

Constructor Details

#initialize(node, message = nil) ⇒ MouseEventFailed

Returns a new instance of MouseEventFailed.



53
54
55
56
57
58
59
60
# File 'lib/capybara/lightpanda/errors.rb', line 53

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.



49
50
51
# File 'lib/capybara/lightpanda/errors.rb', line 49

def node
  @node
end

#positionObject (readonly)

Returns the value of attribute position.



49
50
51
# File 'lib/capybara/lightpanda/errors.rb', line 49

def position
  @position
end

#selectorObject (readonly)

Returns the value of attribute selector.



49
50
51
# File 'lib/capybara/lightpanda/errors.rb', line 49

def selector
  @selector
end