Pregunta

¿Existen implementaciones de todos los métodos ingeniosos de Selenium on Rails como wait_for_visible , assert_not_text_present , ... para el controlador ruby ??de Selenium RC ?

Si no, ¿cómo haría para implementar algo como wait_for_visible?

¿Fue útil?

Solución

Resolví mi propio problema.

Encontré al cliente oficial de ruby ??en Repositorio de Git Hub

Escribí esta solución para que solo pueda requerir este código, luego puede usar todos los útiles wait_for_ *, assert_ *, assert_not_ *, wait_for_not_ *, Verify_ *, y Verify_not _ * comandos.

#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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top