Module Celerity::Container
In: lib/celerity/container.rb
lib/celerity/watir_compatibility.rb

This class contains methods for accessing elements inside a container, usually the Browser object, meaning the current page. The most common syntax is

  browser.elem(:attribute, 'value')

Note that the element is located lazily, so no exceptions will be raised if the element doesn‘t exist until you call a method on the resulting object. To do this you would normally use Element#exists? or an action method, like ClickableElement#click. You can also pass in a hash:

  browser.link(:index => 1).click

All elements support multiple attributes identification using the hash syntax (though this might not always be compatible with Watir):

  browser.span(:class_name => 'product', :index => 5).text

Checkboxes and radio buttons support a special three-argument syntax:

  browser.check_box(:name, 'a_name', '1234').set

You can also get all the elements of a certain type by using the plural form (@see Celerity::ElementCollection):

  browser.links # => #<Celerity::Links:0x7a1c2da2 ...>

Methods

a   area   areas   as   bodies   body   button   buttons   cell   cells   checkBox   check_box   checkbox   checkboxes   container=   contains_text   dd   dds   del   dels   div   divs   dl   dls   dt   dts   em   ems   file_field   file_fields   form   forms   frame   frames   h1   h1s   h2   h2s   h3   h3s   h4   h4s   h5   h5s   h6   h6s   hidden   hiddens   image   images   ins   inses   inspect   label   labels   li   link   links   lis   map   maps   meta   metas   ol   ols   option   p   pre   pres   ps   radio   radios   row   rows   select_list   select_lists   span   spans   strong   strongs   table   tables   tbodies   tbody   td   tds   text_field   text_fields   tfeet   tfoot   tfoots   th   thead   theads   ths   ul   uls  

Included Modules

Celerity::Exception Celerity::ShortInspect

Attributes

browser  [R]  Points back to the Browser instance that contains this element

Public Instance methods

a(*args)

Alias for link

as()

Alias for links

bodies()

Alias for tbodies

body(*args)

Alias for tbody

checkBox(*args)

Alias for check_box

Since finding checkboxes by value is very common, you can use this shorthand:

  browser.check_box(:name, 'a_name', '1234').set

or

  browser.check_box(:name => 'a_name', :value => '1234').set

@return [Celerity::CheckBox]

checkbox(*args)

Alias for check_box

Used internally to update the container object. @api private

Check if the element contains the given text.

@param [String, Regexp] expected_text The text to look for. @return [Fixnum, nil] The index of the matched text, or nil if it doesn‘t match.

Override inspect for readability

Since finding radios by value is very common, you can use this shorthand:

  browser.radio(:name, 'a_name', '1234').set

or

  browser.radio(:name => 'a_name', :value => '1234').set

@return [Celerity::Radio]

td(*args)

Alias for cell

tds()

Alias for cells

tfeet()

Alias for tfoots

Watir‘s cells() won‘t find <th> elements. This is a workaround.

@return [Celerity::Th]

FIXME: implement or change api, @see th

[Validate]