lib/page-object/elements/element.rb in page-object-0.9.8 vs lib/page-object/elements/element.rb in page-object-1.0
- old
+ new
@@ -120,17 +120,17 @@
btn_ident[:text] = btn_ident[:value]
btn_ident.delete(:value)
end
xpath = ".//button"
xpath << "[#{attribute_expression(btn_ident)}]" unless btn_ident.empty?
- xpath << "[#{idx+1}]" if idx
+ xpath = "(#{xpath})[#{idx+1}]" if idx
identifier[:type] = %w[button reset submit image]
xpath << " | .//input"
else
xpath = ".//#{tag_locator}"
end
xpath << "[#{attribute_expression(identifier)}]" unless identifier.empty?
- xpath << "[#{idx+1}]" if idx
+ xpath = "(#{xpath})[#{idx+1}]" if idx
xpath
end
def self.attribute_expression(identifier)
identifier.map do |key, value|