Base class containing items that are common between the span, div, label, p and pre classes.
# File lib/firewatir/elements/non_control_element.rb, line 5 def self.inherited subclass class_name = Watir::Util.demodulize(subclass.to_s) method_name = Watir::Util.underscore(class_name) FireWatir::Container.module_eval "def #{method_name}(how, what=nil) locate if respond_to?(:locate) return #{class_name}.new(self, how, what); end" end
how - Attribute to identify the element.
what - Value of that attribute.
# File lib/firewatir/elements/non_control_element.rb, line 33 def initialize(container, how, what) #@element = Element.new(nil) @how = how @what = what @container = container @o = nil end
Description:
Locate the element on the page. Element can be a span, div, label, p or pre HTML tag.
# File lib/firewatir/elements/non_control_element.rb, line 19 def locate case @how when :jssh_name @element_name = @what when :xpath @element_name = element_by_xpath(@container, @what) else @element_name = locate_tagged_element(self.class::TAG, @how, @what) end @o = self end
Returns a string of properties of the object.
# File lib/firewatir/elements/non_control_element.rb, line 42 def to_s(attributes = nil) assert_exists hash_properties = {"text"=>"innerHTML"} hash_properties.update(attributes) if attributes != nil r = super(hash_properties) #r = string_creator #r += span_div_string_creator return r.join("\n") end