2010-01-30 11 views
0

我正在學習Selenium。我將在Ruby on Rails項目中使用它。現在我創建了演示項目來測試Selenium on Rails。 #{RAILS_ROOT} /test/selenium/articles/delete_article.rsel的如何在Selenium的Ruby on Rails實現中使用警報並提示JS對話框?

內容是以下幾點:

setup :fixtures => :all 

open "/articles" 

assert_text_present("First Article title") 
assert_text_present("Destroy") 

click_and_wait("Destroy") 
assert_match /Are you sure/i, get_confirmation 

assert_text_present("Articles") 
assert_text_not_present("First Article title") 

在本次測試來看,我得到以下錯誤:

undefined local variable or method `get_confirmation' for #<SeleniumOnRails::RSelenese::Evaluator 

其他測試(不對話框)沒有任何問題。

關於配置的一些信息:

  • 紅寶石1.8.7(2009-06-12 PATCHLEVEL 174)[x86_64的Linux的]
  • 滑軌2.3.5
  • RubyGems的1.3.5
  • Selenium on Rails插件(REVISION 38 最後在日誌 CHANGELOG中提到)http://svn.openqa.org/svn/selenium-on-rails/stable/selenium-on-rails
  • 沒有遠程控制。沒有安裝寶石 與硒有關。
  • Linux的HSH 2.6.31-17-通用#54,Ubuntu的SMP週四12月10日17時01分44秒UTC 2009年x86_64的 GNU/Linux的
  • 火狐3.5.7

任何想法如何可以修復?

感謝

回答

1

試試這個:

assert_alert /Are you sure/i 

或本:

assert_confirmation /Are you sure/i 

SeleniumOnRails rdoc

相關問題