LoginSignup
0
0

More than 5 years have passed since last update.

Frankのtouchで"some views could not be touched"エラーが出たときの対処法

Last updated at Posted at 2013-10-01

はじめに

  • Frankでテストを書いているとtouchするときに以下のエラーがでた
    • some views could not be touched (probably because they are not within the current viewport) (RuntimeError)

対策

  • このエラーはtouchするターゲットが取得できていないときに発生する
    • SeleniumではElement not found的な感じ
    • 自動で取得するまで待ってはくれないので待機時間を挟む必要がある
  • 以下のように対策した
    • touchをオーバーライドした
    • 不正なセレクタを渡したときのエラーはそのまま(エラーとして出す)
    • 早すぎてとれていないという場合にのみリトライをするようにした
module Frank
  module Cucumber
    module FrankHelper
      def touch( uiquery )
        views_touched = frankly_map( uiquery, 'touch' )
        raise "could not find anything matching [#{uiquery}] to touch" if views_touched.empty?
        self.touch(uiquery) if views_touched.first == false # この1行を追加
      end
    end
  end
end

~ただの宣伝~

  • 全国のSeleniumer必読
  • Seleniumerといっていますが、Selenium, SauceLabs, Travis, Jenkinsに関するノウハウ書いているのでよかったら参考にしてみてください
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0