Module: Capybara::WithElementHandlePatch

Defined in:
lib/capybara/playwright/node.rb

Instance Method Summary collapse

Instance Method Details

#with_playwright_element_handle(&block) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
# File 'lib/capybara/playwright/node.rb', line 18

def with_playwright_element_handle(&block)
  raise ArgumentError.new('block must be given') unless block

  if native.is_a?(::Playwright::ElementHandle)
    block.call(native)
  else
    raise "#{native.inspect} is not a Playwirght::ElementHandle"
  end
end