Module: Watir::Locators::ClassHelpers
- Included in:
- Element, ElementCollection
- Defined in:
- lib/watir/locators.rb
Instance Method Summary collapse
- #class_from_string(string) ⇒ Object
- #element_class_name ⇒ Object
- #element_matcher_class ⇒ Object
- #locator ⇒ Object
- #locator_class ⇒ Object
- #selector_builder ⇒ Object
- #selector_builder_class ⇒ Object
Instance Method Details
#class_from_string(string) ⇒ Object
59 60 61 |
# File 'lib/watir/locators.rb', line 59 def class_from_string(string) Watir.const_get(string) if Watir.const_defined?(string) end |
#element_class_name ⇒ Object
63 64 65 |
# File 'lib/watir/locators.rb', line 63 def element_class_name element_class.to_s.split('::').last end |
#element_matcher_class ⇒ Object
45 46 47 48 49 50 |
# File 'lib/watir/locators.rb', line 45 def element_matcher_class class_from_string("#{browser.locator_namespace}::#{element_class_name}::Matcher") || class_from_string("Watir::Locators::#{element_class_name}::Matcher") || class_from_string("#{browser.locator_namespace}::Element::Matcher") || Locators::Element::Matcher end |
#locator ⇒ Object
71 72 73 74 |
# File 'lib/watir/locators.rb', line 71 def locator @element_matcher ||= element_matcher_class.new(@query_scope, @selector.dup) @locator ||= locator_class.new(@element_matcher) end |
#locator_class ⇒ Object
38 39 40 41 42 43 |
# File 'lib/watir/locators.rb', line 38 def locator_class class_from_string("#{browser.locator_namespace}::#{element_class_name}::Locator") || class_from_string("Watir::Locators::#{element_class_name}::Locator") || class_from_string("#{browser.locator_namespace}::Element::Locator") || Locators::Element::Locator end |
#selector_builder ⇒ Object
67 68 69 |
# File 'lib/watir/locators.rb', line 67 def selector_builder @selector_builder ||= selector_builder_class.new(element_class.attribute_list, @query_scope) end |
#selector_builder_class ⇒ Object
52 53 54 55 56 57 |
# File 'lib/watir/locators.rb', line 52 def selector_builder_class class_from_string("#{browser.locator_namespace}::#{element_class_name}::SelectorBuilder") || class_from_string("Watir::Locators::#{element_class_name}::SelectorBuilder") || class_from_string("#{browser.locator_namespace}::Element::SelectorBuilder") || Locators::Element::SelectorBuilder end |