Sha256: 39d60c7f2f82cbff8cb2b0ba0da0e973ea438428b978c8c23480bfe6772ecb3f

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

module Prickle
  module Actions
    module Match

      def contains_text? text
        handle_exception do
          find_element_by_name_and_text(@type, @identifier, text)
        end
      end

      def method_missing method, *args
        if method =~ /(^.*)_contains_text\?$/
          find_element_by_name_and_text($1,  { :name => args.first } , args[1])
        else
          super
        end
      end

      private

      def find_by_name_and_text_xpath element, identifier, text
        "//#{type_of(element)}[#{xpath_for(identifier)} and contains(text(), '#{text}')]"
      end

      def find_element_by_name_and_text element, name, text
        handle_exception do
          find_element_by(find_by_name_and_text_xpath(element, name, text))
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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