質問

wait_for_visibleのような気の利いた Selenium on Rails メソッドの実装はありますか assert_not_text_present 、... Selenium RCのrubyドライバー ??

そうでない場合、wait_for_visibleのようなものをどのように実装しますか?

役に立ちましたか?

解決

自分の問題を解決しました。

Git Hubリポジトリで公式のRubyクライアントを見つけました

このコードを require できるようにこのソリューションを作成し、すべての便利な wait_for _ *、assert _ *、assert_not _ *、wait_for_not _ *、verify_ *、およびverify_not _ * コマンド。

#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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top