Method: Selenium#type?

Defined in:
lib/selenium/selenium.rb

#type?(keys, args = {}) ⇒ Boolean

Public: Types on the device. The keys will be typed into the selected/focused element.

keys - String or Array of String keys to type. touch - Boolean indicating whether to simulate physical key presses (default: false). sleep_time - Integer total milliseconds to sleep after typing (default: 0).

Returns a Boolean true if successfully typed, otherwise false.

Returns:



378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/selenium/selenium.rb', line 378

def type?(keys, args={})
  unless keys.is_a?(Hash)
    keys = {:keys => keys}
  end
  args = keys.merge(args)
  args[:touch] ||= false
  unless args[:keys].is_a?(Array)
    args[:keys] = args[:keys].split('')
  end
  ret = selenium_post('type', args)
  sleep(args.fetch(:sleep_time, 0.sec))
  !ret.nil?
end