jump to navigation

Selenium on Rails breaks on Rails 2.1 July 4, 2008

Posted by Indraneel in Ruby on Rails.
Tags: ,
trackback

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.

Comments»

1. daniel - July 6, 2008

Thanks, that fast tracked my problem solving

2. Jonny Mac - July 30, 2008

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

3. Ryan Bates - July 30, 2008

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

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

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

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

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

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