How to use alerts and prompts JS dialogs in Ruby on Rails implementation of Selenium?
I'm learning Selenium now. I'm going to use it in the Ruby on Rails project. Now I created demo project just to test Selenium on Rails.
Content of #{RAILS_ROOT}/test/selenium/articles/delete_article.rsel is following:
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")
During this test run I get following error:
undefined local variable or method `get_confirmation' for #<SeleniumOnRails::RSelenese::Evaluator
Other tests (without dialogs) are working without any problems.
Some info about configuration:
- ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
- Rails 2.3.5
- Rubygems 1.3.5
- Selenium on Rails plugin (REVISION 38 is last mentioned in the log CHANGELOG) from he开发者_开发技巧re http://svn.openqa.org/svn/selenium-on-rails/stable/selenium-on-rails
- No Remote Control. No installed gems related to selenium.
- Linux hsh 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 17:01:44 UTC 2009 x86_64 GNU/Linux
- Firefox 3.5.7
Any ideas how this can be fixed?
Thanks
Try this:
assert_alert /Are you sure/i
or this:
assert_confirmation /Are you sure/i
More in SeleniumOnRails rdoc
精彩评论