Sha256: 42b264c31af6cbccf98862e65f5a57f15fc22893a81795df62a2d23cc5f7589e
Contents?: true
Size: 651 Bytes
Versions: 10
Compression:
Stored size: 651 Bytes
Contents
module Capybara class Selector def custom(f, &block) @format = f @custom = block if block @custom end def call(locator) if @format == :css @css.call(locator) elsif @format == :xpath @xpath.call(locator) else @custom.call(locator) end end end end Capybara.add_selector(:id) do custom(:id) { |locator| locator } end Capybara.add_selector(:class) do custom(:class) { |locator| locator } end Capybara.add_selector(:name) do custom(:name) { |locator| locator } end Capybara.add_selector(:accessibility_id) do custom(:accessibility_id) { |locator| locator } end
Version data entries
10 entries across 10 versions & 1 rubygems