Home > Ruby on Rails > Selenium on Rails breaks on Rails 2.1

Selenium on Rails breaks on Rails 2.1

We upgraded ourselves to Rails 2.1. And builds started failing. Bamboo showed me a “undefined method – register_template_handler” error.

.../​vendor/​ plugins/​selenium-on-rails/​lib/​selenium_on_rails/​selenese.rb:3: undefined method `register_template_handler' for ActionView::Base:Class (NoMethodError)

It happened for rselenese.rb too.
It seems they moved “register_template_handler” from ActionView::Base to ActionView::Template in Rails 2.1. So I went in and changed

ActionView::Base.register_template_handler 'sel', SeleniumOnRails::Selenese
To
ActionView::Template.register_template_handler 'sel', SeleniumOnRails::Selenese

And bingo! it worked fine as it was working earlier.

Categories: Ruby on Rails Tags:
  1. daniel
    July 6, 2008 at 2:06 pm | #1

    Thanks, that fast tracked my problem solving

  2. Jonny Mac
    July 30, 2008 at 2:31 am | #2

    I can confirm this problem as well. I’ll submit a bug to the openqa site, see what happens.

  3. July 30, 2008 at 3:17 am | #3

    There are a few other things that are broken on 2.1 as well. However I have a fork with the proper fixes here:

    http://github.com/ryanb/selenium-on-rails/tree/master

  4. Cindy
    July 30, 2008 at 8:54 pm | #4

    Hi. I have not used Selenium prior to 2.1 so I don’t know if it’s a code issue or a 2.1 issue. I applied the above fix, but now I get 37 errors that all appear to be Render Errors.

    Any thoughts?

  5. Cindy
    August 4, 2008 at 9:35 pm | #5

    Are there other options for testing the Rails 2.1 user interface besides Selenium? I need to get this tested in 2.1 and get the project done.

  6. Indraneel
    August 6, 2008 at 4:09 pm | #6

    Cindy,
    You can use Selenium Remote Control to test your UI. The core is still the same but you don’t have to use the Selenium on Rails – the Rails plugin. Alternatively, if you don’t have to test web-applications that use AJAX you can use Watir – http://wtr.rubyforge.org. However Watir only works on IE. However, there is FireWatir for testing on Firefox.

    I would also suggest that you post your errors in a comment over here along with your selenium test code and configuration. I might be able to tell you what’s wrong.

  7. Cindy
    September 16, 2008 at 7:29 pm | #7

    I just did a script/plugin install command. Then when I run rake inside of the selenium plugin folder on my windows machine I get the following error. I do have win32-open3 installed too.

    C:\var\project\vendor\plugins\selenium-on-rails>rake
    (in C:/var/project/vendor/plugins/selenium-on-rails)
    c:/ruby/bin/ruby -Ilib;lib “c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/r
    ake_test_loader.rb” “test/renderer_test.rb” “test/rselenese_test.rb” “test/selen
    ese_test.rb” “test/selenium_controller_test.rb” “test/selenium_support_test.rb”
    “test/setup_test.rb” “test/suite_renderer_test.rb”
    c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_re
    quire’: no such file to load — mocha (MissingSourceFile)

  8. Cindy
    September 16, 2008 at 7:35 pm | #8

    Oh, ignore my last post. I just installed the mocha gem and all is great!

  9. Reseller Hosting
    January 6, 2010 at 12:23 pm | #9

    Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

  1. No trackbacks yet.