数ステップ戻る必要がある自動テストを作成しています。Watirでそれを行うことは可能ですか??
結果リスト ページに移動していて、[戻る] をクリックするだけでテストの最初に戻りたい (Windows ブラウザー)。thnx
Watir :: IEオブジェクトがある場合、#backは探していることを実行するメソッドです。
どのようなエラーが発生していますか?
これは私がそれをやろうとした方法です:
@site.ie.wait_until(1200) { |ie| ie.contains_text(/Sort after/) }
2.times{@site.ie.back
}
Watir の #back 呼び出しを使用するサンプル コード ( Wikipedia の標準的な例に基づく):
require 'watir'
test_site = 'http://www.google.com/'
ie = Watir::IE.new
ie.goto(test_site)
ie.text_field(:name, "q").set("pickaxe")
ie.button(:name, "btnG").click
if ie.text.include?("Programming Ruby")
puts "Test Passed. Found the test string: 'Programming Ruby'."
else
puts "Test Failed! Could not find: 'Programming Ruby'."
end
ie.back
if ie.url == test_site
puts "Test Passed. Returned to search page."
else
puts "Test Failed! URL is now #{ie.url}."
end
ie.close