lib/page-object/elements/element.rb in page-object-1.0.2 vs lib/page-object/elements/element.rb in page-object-1.0.3
- old
+ new
@@ -57,10 +57,21 @@
#
def class_name
attribute 'class'
end
+ #
+ # specify plural form of element
+ #
+ def self.plural_form
+ "#{self.to_s.split('::')[-1].
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
+ tr("-", "_").
+ downcase}s"
+ end
+
# @private
def self.watir_identifier_for identifier
if should_build_watir_xpath(identifier)
how = :xpath
what = build_xpath_for(identifier)
@@ -105,10 +116,10 @@
end
protected
def self.should_build_watir_xpath identifier
- ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'label', 'area', 'canvas', 'audio', 'video'].include? identifier[:tag_name] and identifier[:name]
+ ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'label', 'area', 'canvas', 'audio', 'video', 'b'].include? identifier[:tag_name] and identifier[:name]
end
def self.build_xpath_for identifier
tag_locator = identifier.delete(:tag_name)
idx = identifier.delete(:index)