Class Celerity::Element
In: lib/celerity/watir_compatibility.rb
lib/celerity/element.rb
Parent: Object

Superclass for all HTML elements.

Methods

Included Modules

Exception Container

Constants

HTML_401_TRANSITIONAL = { :core => [:class, :id, :style, :title], :cell_halign => [:align, :char, :charoff], :cell_valign => [:valign], :i18n => [:dir, :lang], :event => [:onclick, :ondblclick, :onmousedown, :onmouseup, :onmouseover, :onmousemove, :onmouseout, :onkeypress, :onkeydown, :onkeyup], :sloppy => [:name, :value]   HTML 4.01 Transitional DTD
CELLHALIGN_ATTRIBUTES = HTML_401_TRANSITIONAL[:cell_halign]
CELLVALIGN_ATTRIBUTES = HTML_401_TRANSITIONAL[:cell_valign]
BASE_ATTRIBUTES = HTML_401_TRANSITIONAL.values_at(:core, :i18n, :event, :sloppy).flatten
ATTRIBUTES = BASE_ATTRIBUTES
TAGS = []
DEFAULT_HOW = nil

External Aliases

exists? -> exists
text -> innerText
text -> inner_text

Attributes

container  [R] 
identifier_string  [W] 

Public Class methods

Public Instance methods

asXml()

Alias for to_xml

as_xml()

Alias for to_xml

Used internally to ensure the element actually exists.

@raise [Celerity::Exception::UnknownObjectException] if the element can‘t be found. @api private

@return [String] A string representation of the element‘s attributes.

@param [String, to_s] The attribute. @return [String] The value of the given attribute.

exist?()

Alias for exists?

Checks if the element exists. @return [true, false]

Fires the given event for this element

Sets the focus to this element.

Returns true if this element is the currently focused element

Celerity-specific.

html()

Alias for to_xml

Return the text content of this DOM node, disregarding its visibility.

(Celerity-specific?)

@see text @return [String]

Returns a JavaScript object representing the receiver

@api internal - subject to change

Used internally. Find the element on the page. @api private

Dynamically get element attributes.

@see ATTRIBUTES constant for a list of valid methods for a given element.

@return [String] The resulting attribute. @raise [NoMethodError] if the element doesn‘t support this attribute.

Returns the HtmlUnit object backing this element

Get the parent element @return [Celerity::Element, nil] subclass of Celerity::Element, or nil if no parent was found

Return a text representation of the element as it would appear in a browser.

@see inner_text @return [String]

@return [String] A string representation of the element.

@return [String] The normative XML representation of the element (including children).

Check if the element is visible to the user or not. Note that this only takes the _style attribute_ of the element (and its parents) into account - styles from applied CSS is not considered.

@return [boolean]

return the canonical xpath for this element (Celerity-specific)

[Validate]