Question

Existe-t-il des méthodes astucieuses Selenium on Rails comme wait_for_visible , assert_not_text_present , ... pour le pilote ruby ??de Selenium RC ?

Si non, comment pourrais-je mettre en œuvre quelque chose comme wait_for_visible?

Était-ce utile?

La solution

J'ai résolu mon propre problème.

J'ai trouvé le client officiel Ruby sur le référentiel Git Hub

J'ai écrit cette solution pour que vous demandiez ce code et que vous puissiez utiliser tout le wait_for_ *, assert_ *, assert_not_ *, wait_for_not_ *, verify_ * et verify_not _ * commandes.

#need this for starts_with? and camelize
require 'activesupport'
module Selenium
  module Client
    class Driver
      def method_missing(method, *args)
        method_prefixes = %w(wait_for wait_for_not assert_ assert_not verify verify_not store)
        method_name = method.to_s

        prefix = method_prefixes.find {|pre| method_name.starts_with?(pre)}

        #if the method starts with a prefix, camelize the name.
        if(prefix)
          string_command method_name.camelize(:lower), *args
        else
          super *args
        end
      end
    end
  end
end
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top