質問
私の作成の自動化試験における航に戻数です。ことはできないWatir??
私は航行をresultlistページに戻りたいの試験をクリックするだけで戻る(windowsブラウザ)Thnx
解決
:あなたはワチール:: IEのオブジェクトを持っている場合は、
、そして、あなたが探しているものない方法がある#back
http://wtr.rubyforge.org/rdoc/classes /Watir/IE.html#M000245する
あなたはどのようなエラーが表示されますか?
他のヒント
これは、私はそれを実行しようとしました方法です。
@site.ie.wait_until(1200) { |ie| ie.contains_text(/Sort after/) }
2.times{@site.ie.back
}
コード例は、使用Watirの#裏話に基づく 標準の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
確かに実行できますね JavaScript ワティールを使って。
@browser.execute_script('window.history.back();')
所属していません StackOverflow