Class: Watir::Container::TextField

Inherits:
InputElement show all
Defined in:
lib/safariwatir.rb

Direct Known Subclasses

Password

Constant Summary

Constants inherited from HtmlElement

HtmlElement::OPERATIONS

Instance Attribute Summary

Attributes inherited from HtmlElement

#how, #what

Instance Method Summary collapse

Methods inherited from InputElement

#by_value, #enabled?, #speak, #tag

Methods included from Clickable

#click

Methods inherited from HtmlElement

#exists?, #name, #operate, #speak, #tag

Instance Method Details

#getContentsObject



393
394
395
# File 'lib/safariwatir.rb', line 393

def getContents
  @scripter.get_value_for(self)
end

#set(value) ⇒ Object



381
382
383
384
385
386
387
388
389
390
391
# File 'lib/safariwatir.rb', line 381

def set(value)
  value = value.to_s
  @scripter.focus(self)
  @scripter.highlight(self) do
    clear_text_input
    value.length.times do |i|
      append_text_input(value[i, 1])
    end
  end
  @scripter.blur(self)
end

#verify_contains(expected) ⇒ Object



397
398
399
400
401
402
403
404
405
# File 'lib/safariwatir.rb', line 397

def verify_contains(expected)
  actual = getContents
  case expected
  when Regexp
    actual.match(expected) != nil
  else
    expected == actual
  end
end