Class: Watir::NonControlElement
- Includes:
- Exception
- Defined in:
- lib/watir/non_control_elements.rb
Overview
this class contains items that are common between the span, div, and pre objects it would not normally be used directly
many of the methods available to this object are inherited from the Element class
Direct Known Subclasses
Area, Dd, Div, Dl, Dt, Em, H1, H2, H3, H4, H5, H6, Label, Li, Map, P, Pre, Span, Strong, Ul
Constant Summary
Constants inherited from Element
Instance Attribute Summary
Attributes inherited from Element
Attributes included from Container
#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(container, how, what) ⇒ NonControlElement
constructor
A new instance of NonControlElement.
- #locate ⇒ Object
-
#to_s ⇒ Object
returns the properties of the object in a string raises an ObjectNotFound exception if the object cannot be found.
Methods inherited from Element
#<=>, #activeObjectHighLightColor, #after_text, #assert_enabled, #assert_exists, #attribute_value, #before_text, #click, #click!, #document, #enabled?, #exists?, #fire_event, #flash, #focus, #inspect, #method_missing, #ole_object, #ole_object=, #parent, #text, #type_keys, #typingspeed, #visible?
Methods included from Container
#area, #areas, #button, #buttons, #cell, #cells, #checkbox, #checkboxes, #dds, #divs, #dls, #dts, #element, #element_by_css, #elements, #ems, #file_field, #file_fields, #form, #forms, #frame, #frames, #hidden, #hiddens, #image, #images, #labels, #link, #links, #lis, #locate_all_elements, #locate_input_element, #locate_tagged_element, #log, #map, #maps, #modal_dialog, #popup, #pres, #ps, #radio, #radios, #row, #rows, #select_list, #select_lists, #set_container, #show_all_objects, #spans, #strongs, #table, #tables, #text_field, #text_fields, #wait
Constructor Details
#initialize(container, how, what) ⇒ NonControlElement
Returns a new instance of NonControlElement.
31 32 33 34 35 36 |
# File 'lib/watir/non_control_elements.rb', line 31 def initialize(container, how, what) set_container container @how = how @what = what super nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Watir::Element
Class Method Details
.inherited(subclass) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/watir/non_control_elements.rb', line 10 def self.inherited subclass class_name = Watir::Util.demodulize(subclass.to_s) method_name = Watir::Util.underscore(class_name) Watir::Container.module_eval <<-RUBY def #{method_name}(how, what=nil) return #{class_name}.new(self, how, what) end RUBY end |
Instance Method Details
#locate ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/watir/non_control_elements.rb', line 21 def locate if @how == :xpath @o = @container.element_by_xpath(@what) elsif @how == :css @o = @container.element_by_css(@what) else @o = @container.locate_tagged_element(self.class::TAG, @how, @what) end end |
#to_s ⇒ Object
returns the properties of the object in a string raises an ObjectNotFound exception if the object cannot be found
49 50 51 52 53 54 |
# File 'lib/watir/non_control_elements.rb', line 49 def to_s assert_exists r = string_creator r += span_div_string_creator return r.join("\n") end |