Trouble making webrat work in selenium mode

Skip to first unread message


Jun 3, 2010, 2:35:41 PM6/3/10
to webrat

I am unable to make Webrat work in selenium mode. On "" I
get the following:
Waiting for Selenium RC server on port 4444...
The requested address is not valid in its context. - connect(2)

I use Rspec, with webrat for integration testing.
Webrat works fine in rails mode, but I currently need to make an
integration test that involved drag and drop so I want to see if
webrat in selenium mode is more effective than selenium on it's own.
Selenium works fine on it's own, but it's a bit cumbersome.

The platform is win7 x64.

Any idea what the problem might be?

Webrat is configured like this:
Webrat.configure do |config|
config.mode = :selenium
config.application_framework = :rails
config.application_environment = :test


Jun 6, 2010, 1:54:16 PM6/6/10
to webrat
Hi Sharagoz,

"config.application_framework = :rails" fails for me too (but with a
different error, I get "mongrel_rails command not found")

However, :sinatra works for me; have you tried that?



Jun 7, 2010, 8:15:59 AM6/7/10
to webrat
Thanks for the suggestion but got the same result in :sinatra mode

I managed to get it working eventually. Here's what I needed to do:
Patch selenium_rc_server.rb and application_servers/base.rb, replacing with
That got selenium RC running, however mongrel would not start. To
solve that I was eventually forced to switch from using the system
command to using IO.popen and make some modifications to the actual
mongrel command.
The next problem was that selenium seemed to fail to detect that a
browser window had been opened, timing out waiting for it. I solved
that by updating selenium-server.jar to the latest version.
And finally I had to set config.selenium_browser_startup_timeout = 30
because the test environment had not finished loading by the time
selenium tried to access it, and would time out.

Is there any interest in a patch that implements windows support for
the selenium mode?

Is it possible to make Webrat switch to selenium mode for specific
tests only?
I don't really like that all the integration tests are now run in a
browser when I only need it for a couple of tests...

Curran Schiefelbein

Jun 7, 2010, 12:20:16 PM6/7/10
I suspect you can put a Webrat config block in any of the test
classes, not just in test_helper.rb

Glad you got it working.


> --
> You received this message because you are subscribed to the Google Groups "webrat" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at

Reply all
Reply to author
0 new messages