Class: Locator::Element::LabeledElement
- Inherits:
-
Locator::Element
- Object
- Locator::Element
- Locator::Element::LabeledElement
- Defined in:
- lib/locator/element/labeled_element.rb
Instance Attribute Summary
Attributes inherited from Locator::Element
#attributes, #css, #locatables, #name
Instance Method Summary collapse
Methods inherited from Locator::Element
#all, #initialize, #locate, #xpath
Constructor Details
This class inherits a constructor from Locator::Element
Instance Method Details
#element_ids(dom, selector) ⇒ Object
10 11 12 |
# File 'lib/locator/element/labeled_element.rb', line 10 def element_ids(dom, selector) Label.new.send(:lookup, dom, selector).map { |element| element.attribute('for') } end |
#lookup(dom, selector, attributes) ⇒ Object
4 5 6 7 8 |
# File 'lib/locator/element/labeled_element.rb', line 4 def lookup(dom, selector, attributes) ids = element_ids(dom, selector) result = ids.empty? ? Result.new : super(dom, nil, attributes.merge(:id => ids)) result.each { |element| element.matches << selector } end |