Sha256: 0b3780bbaa5af458701751eada4d80d7eccaf8230be40209331cedf9c5af2ce0

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

module Prickle
  module Actions
    module Find

      def find_by_name type='*', name
        find_element_by_identifier type, { :name => name }
      end

      def exists?
        find_element_by_identifier @type, @identifier
      end

      private

      def method_missing method, *args
        if method =~ /^find_(.*)_by_name$/
          find_by_name $1, args.first
        else
          super
        end
      end

      def find_by_identifier_xpath element, identifier
        "//#{type_of(element)}[#{xpath_for(identifier)}]"
      end

      def find_element_by_identifier element, identifier
        @type = element; @identifier = identifier
        handle_exception do
          find_element_by(find_by_identifier_xpath(element, identifier ))
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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