Class: Watir::Locators::Cell::SelectorBuilder

Inherits:
Element::SelectorBuilder show all
Defined in:
lib/watir-webdriver/locators/cell/selector_builder.rb

Constant Summary

Constants inherited from Element::SelectorBuilder

Element::SelectorBuilder::VALID_WHATS, Element::SelectorBuilder::WILDCARD_ATTRIBUTE

Instance Method Summary collapse

Methods inherited from Element::SelectorBuilder

#build, #check_type, #initialize, #normalized_selector, #should_use_label_element?, #xpath_builder

Constructor Details

This class inherits a constructor from Watir::Locators::Element::SelectorBuilder

Instance Method Details

#build_wd_selector(selectors) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/watir-webdriver/locators/cell/selector_builder.rb', line 5

def build_wd_selector(selectors)
  return if selectors.values.any? { |e| e.kind_of? Regexp }

  expressions = %w[./th ./td]
  attr_expr = xpath_builder.attribute_expression(nil, selectors)

  unless attr_expr.empty?
    expressions.map! { |e| "#{e}[#{attr_expr}]" }
  end

  xpath = expressions.join(" | ")

  p build_wd_selector: xpath if $DEBUG

  [:xpath, xpath]
end