Module: CapybaraExtensions::Locators
Overview
Locators for xpath.
Instance Method Summary collapse
-
#image_locator(options) ⇒ String
Builds a locator via the given src or alt.
-
#meta_tag_locator(name, content) ⇒ String
Builds a locator via the given name and content.
Instance Method Details
#image_locator(options) ⇒ String
Builds a locator via the given src or alt.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/capybara-extensions/locators.rb', line 9 def image_locator() locator = String.new if [:src] if Regexp === [:src] && image = _find_image_with_regex([:src]) locator.concat("[@src='#{image}']") else [:src] locator.concat "[@src='#{[:src]}']" end end locator.concat "[@alt='#{[:alt]}']" if [:alt] locator end |
#meta_tag_locator(name, content) ⇒ String
Builds a locator via the given name and content.
30 31 32 33 34 35 |
# File 'lib/capybara-extensions/locators.rb', line 30 def (name, content) locator = String.new locator.concat "[@name='#{name}']" locator.concat "[@content='#{content}']" locator end |