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
Rails
Thanks, that fast tracked my problem solving
I can confirm this problem as well. I’ll submit a bug to the openqa site, see what happens.
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
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?
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.
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.
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)
Oh, ignore my last post. I just installed the mocha gem and all is great!
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!