Sha256: 6d3f783925dc9369e3a0ac2ec7cedc4f997728c7306e7763569ae1128194e812

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

module Prickle
  module Actions
    module Match

      def contains_text? text
        handle_exception do
          find_element_by_identifier_and_text
        end
      end

      private

      def xpath_for_identifier
        "//#{type_of(@type)}[#{identifier}]"
      end

      def xpath_for_identifier_and_text
        "//#{type_of(@type)}[#{identifier} and contains(text(), '#{@text}')]"

      end
      def find_element_by_identifier
        handle_exception do
          find_element_by xpath_for_identifier
        end
      end

      def find_element_by_identifier_and_text
        handle_exception do
          find_element_by xpath_for_identifier_and_text
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prickle-0.0.2 lib/prickle/capybara/match.rb