Class: Watir::Hidden

Inherits:
TextField show all
Defined in:
lib/watir/input_elements.rb

Overview

this class can be used to access hidden field objects Normally a user would not need to create this object as it is returned by the Watir::Container#hidden method

Constant Summary collapse

INPUT_TYPES =

:stopdoc:

["hidden"]

Constants inherited from Element

Element::TO_S_SIZE

Instance Attribute Summary

Attributes inherited from Element

#container

Attributes included from Container

#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed

Instance Method Summary collapse

Methods inherited from TextField

#abhors_typing, #assert_not_readonly, #dragContentsTo, #drag_contents_to, #maxLength, #maxlength, #requires_typing, #to_s, #value=, #verify_contains

Methods inherited from InputElement

#initialize, #locate

Methods inherited from Element

#<=>, #__ole_inner_elements, #activeObjectHighLightColor, #after_text, #assert_enabled, #assert_exists, #attribute_value, #before_text, #click, #click!, #create_event, #dispatch_event, #document, #enabled?, #exists?, #fire_event, #flash, inherited, #initialize, #inspect, #locate, #method_missing, #name, #ole_object, #ole_object=, #parent, #text, #to_s, #type_keys, #typingspeed

Methods included from Container

#__ole_inner_elements, #input_element_locator, #locator_for, #log, #set_container, #show_all_objects, #tagged_element_locator, #wait

Constructor Details

This class inherits a constructor from Watir::InputElement

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Watir::Element

Instance Method Details

#append(n) ⇒ Object

override the append method, so that focus isnt set to the hidden object



460
461
462
# File 'lib/watir/input_elements.rb', line 460

def append(n)
  self.value = self.value.to_s + n.to_s
end

#clearObject

override the clear method, so that focus isnt set to the hidden object



465
466
467
# File 'lib/watir/input_elements.rb', line 465

def clear
  self.value = ""
end

#focusObject

this method will do nothing, as you cant set focus to a hidden field



470
471
# File 'lib/watir/input_elements.rb', line 470

def focus
end

#set(n) ⇒ Object

set is overriden in this class, as there is no way to set focus to a hidden field



455
456
457
# File 'lib/watir/input_elements.rb', line 455

def set(n)
  self.value = n
end

#visible?Boolean

Hidden element is never visible - returns false.

Returns:

  • (Boolean)


474
475
476
477
# File 'lib/watir/input_elements.rb', line 474

def visible?
  assert_exists
  false
end