IDBD
IDBD

Reputation: 298

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:

Any ideas how this can be fixed?

Thanks

Upvotes: 0

Views: 291

Answers (1)

St.Woland
St.Woland

Reputation: 5427

Try this:

assert_alert /Are you sure/i

or this:

assert_confirmation /Are you sure/i

More in SeleniumOnRails rdoc

Upvotes: 1

Related Questions