Class: Capybara::Playwright::Node::TextInput

Inherits:
Settable
  • Object
show all
Defined in:
lib/capybara/playwright/node.rb

Instance Method Summary collapse

Methods inherited from Settable

#initialize

Constructor Details

This class inherits a constructor from Capybara::Playwright::Node::Settable

Instance Method Details

#set(value, **options) ⇒ Object



241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/capybara/playwright/node.rb', line 241

def set(value, **options)
  text = value.to_s
  if text.end_with?("\n")
    @element.fill(text[0...-1], timeout: @timeout)
    @element.press('Enter', timeout: @timeout)
  else
    @element.fill(text, timeout: @timeout)
  end
rescue ::Playwright::TimeoutError
  raise if @element.editable?

  puts "[INFO] Node#set: element is not editable. #{@element}"
end