Sha256: 11a33af60aa9eb4535b4fef13ff1beb69406c28b78eff9e40c514e6739cd47a9
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require_relative 'capybara/find' require_relative 'capybara/click' require_relative 'capybara/match' require_relative 'capybara/exceptions' module Prickle TAGS = { :link => 'a', :paragraph => 'p' } module Capybara class << self attr_accessor :wait_time end include Prickle::Actions::Find include Prickle::Actions::Click include Prickle::Actions::Match def element type='*', identifier @identifier = identifier @type = type self end private def xpath_for identifier return identifier.each_pair.to_a.map do |key, value| "@#{key}='#{value}'" end.join ' and ' end def find_element_by xpath wait_until(Prickle::Capybara.wait_time) do find(:xpath, xpath).visible? end unless Prickle::Capybara.wait_time.nil? find(:xpath, xpath) end def type_of element Prickle::TAGS[element.to_sym] || element end def handle_exception &block begin block.call rescue Exception => e raise Capybara::ElementNotFound.new(@type, @identifier, @text, e) if e.class.to_s == "Capybara::ElementNotFound" raise end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prickle-0.0.1 | lib/prickle/capybara.rb |