Class Celerity::ElementCollection
In: lib/celerity/element_collection.rb
Parent: Object

This class is the superclass for the iterator classes (Buttons, Links, Spans etc.) It would normally only be accessed by the iterator methods (Browser#spans, Browser#links, …).

Methods

[]   each   empty?   first   last   length   new   size   to_s  

Included Modules

Enumerable

Public Class methods

Public Instance methods

Get the element at the given index. By default, this is 1-indexed to keep compatibility with Watir.

Also note that because of Watir‘s lazy loading, this will return an Element instance even if the index is out of bounds.

@param [Fixnum] n Index of wanted element, 1-indexed unless Celerity.index_offset is changed. @return [Celerity::Element] Returns a subclass of Celerity::Element

@yieldparam [Celerity::Element] element Iterate through the elements in this collection.

Returns true if the collection is empty.

Get the first element in this collection. (Celerity-specific)

@return [Celerity::Element] Returns a subclass of Celerity::Element

Get the last element in this collection. (Celerity-specific)

@return [Celerity::Element] Returns a subclass of Celerity::Element

@return [Fixnum] The number of elements in this collection.

size()

Alias for length

Note: This can be quite useful in irb:

  puts browser.text_fields

@return [String] A string representation of all elements in this collection.

[Validate]