Trouble making webrat work in selenium mode

29 views
Skip to first unread message

Sharagoz

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

I am unable to make Webrat work in selenium mode. On "selenium.open" I
get the following:
Waiting for Selenium RC server on port 4444...
Errno::EADDRNOTAVAIL
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
end

Curran

unread,
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?

Curran

Sharagoz

unread,
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
0.0.0.0 with 127.0.0.1
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

unread,
Jun 7, 2010, 12:20:16 PM6/7/10
to web...@googlegroups.com
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.

Curran

> --
> You received this message because you are subscribed to the Google Groups "webrat" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to webrat+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webrat?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages