webrat + selenium + ffox3 => timeout after 0ms (Selenium::CommandError)

Skip to first unread message


Mar 28, 2009, 3:17:27 PM3/28/09
to webrat
I work on an Ubuntu 8.10 machine, FFox 3.08 and followed


to set up cucumber with selenium etc.

All scenarios and steps pass in "webrat only" mode. With "cucumber -p
selenium" all steps pass visually (looking at FFox), but randomly
there happens a strange timeout on some steps, that make them fail:

Scenario: local user logs in with wrong password # features/
Given I am not yet logged in # features/
When I visit "/" # features/
And I enter a local user's name and wrong password # features/
And I click on "anmelden" # features/
ed out after 0ms (Selenium::CommandError)
/opt/ruby-enterprise/lib/ruby/1.8/timeout.rb:62:in `timeout'
/opt/ruby-enterprise/lib/ruby/1.8/timeout.rb:93:in `timeout'
selenium_session.rb:65:in `click_button'
(eval):2:in `click_button'
./features/step_definitions/session_steps.rb:27:in `/^I click on
features/enhanced/533386.feature:57:in `And I click on
Then I should see "Die Anmeldung ist fehlgeschlagen." # features/

The count of failed steps differs from time to time. I'd be grateful
for any hint ;)
Best regards, Frank


Mar 28, 2009, 5:18:18 PM3/28/09
to webrat
Some additional info:
from the log of the startet selenium server I got this a couple of

22:13:53.072 INFO - Got result: ERROR: Couldn't access document.body.
Is this HTML page fully loaded? on session

However, the count of these error messages and the count of failed
steps were similar, but not equal.

Gary Taylor

Mar 29, 2009, 1:54:15 AM3/29/09
to web...@googlegroups.com
I had exactly this problem after firefox was upgraded to the latest
version. I went back to the previous version and everything was ok.
Maybe there are issues with webrat / selenium and the latest version
of firefox.



Mar 29, 2009, 6:22:04 AM3/29/09
to webrat

thank you for your reply!
I tried it with an Ubuntu 8.04/FFox 3.06 and the same happend. Even
making cucumber start an old FFox2.0.0.20 from Mozilla produced the
same effect.
Should I mention, that I use Rails 2.3.2 with the actual brynary-
webrat-plugin (pre 0.4.3), cucumber 0.2.2?
I tried replacing the included selenium-server.jar by the beta2-one
from here:
same thing...
- Frank

Gary Taylor

Mar 29, 2009, 1:09:40 PM3/29/09
to web...@googlegroups.com
I wonder if it was the firefox upgrade then ? I have a very similar
setup but using suse instead of ubuntu. Also using latest rails.
Suse did an automatic upgrade, of which firefox was a part of. I was
lucky in that I use a virtual machine and was able to roll everything
back and everything then worked.
I am not using a recent cucumber though, but I can't see that having
any effect.

Gary Taylor


Mar 29, 2009, 1:17:22 PM3/29/09
to webrat
Hm, I did some more trial and error research: all of the combinations

- Rails 2.3.2 vs. 2.2.2
- webrat plugin pre0.4.3 vs. gem 0.4.0
- selenium-server via Selenium-gem and server startet manually
- the different selenium-server.jar's in plugin, gems patched with
beta from seleniumhq.org

lead to the same error. Maybe I do something general wrong - a typical
(sometimes) failing step definition would be:

Before do
Given "the admin-user account exists"

Given /^the admin\-user account exists$/ do
unless User.find_by_login("admin")
roll = Factory.create(:roll, :name => 'Admins', :id => 1)
user = Factory.create(:user, :ldap => false, :login =>
'admin', :name => 'Admin User', :roll_ids => [roll.id], :id => 1)
member = Factory.create(:member, :roll => roll, :user => user)

When /^I visit "([^\"]*)"$/ do |arg1|
visit arg1

When /^I click on "([^\"]*)"$/ do |arg1|
click_button arg1

When /^I enter the admin's username and password$/ do
fill_in "login", :with => "admin"
fill_in "password", :with => "p4ssw0rd"


This works painless with plain webrat.
- Frank

Gary Taylor

Mar 29, 2009, 1:52:42 PM3/29/09
to web...@googlegroups.com
Do you know what it is doing when failing ?
Have you ever had this test running succesfully ?
I have had a few problems with webrat and selenium with buttons.
I believe that if you are clicking on a button, it must be of type
<input type='submit'> and the your test must use the value of the
tag. Button tags do not work.

Gary Taylor


Mar 29, 2009, 2:18:47 PM3/29/09
to webrat
unfortunately, you can't predict when it fails. From

10 scenarios
5 failed steps
13 skipped steps
33 passed steps

sometimes 2 fail, sometimes 7, sometimes all pass (seldom). Of course
I don't chnage the steps in between. Without selenium (webrat only)
they all pass all the time.
The failing steps also differ - some just contain "follow link", some
contain button clicks. I have the impression, it's a kind of timing
- Frank

Gary Taylor

Mar 29, 2009, 2:27:24 PM3/29/09
to web...@googlegroups.com
I am at a bit of a loss then !! Sorry.

However, I had a similar experience when I tried running my tests on
the server as opposed to my local machine (and never did it again
because of this problem !!!) Different things were happening all of
the time like the symptoms that you are having. I was never sure of
the reasons for this though.

Sorry I couldn't be of any more help



Mar 29, 2009, 2:41:37 PM3/29/09
to webrat
Hurray! It's a reported bug and there is already a working patch for

Thank's a lot Gary for your patience and tips - I'm just getting into
knowing where to look first ;)
- Frank

Jacques Crocker

Mar 30, 2009, 4:19:23 AM3/30/09
to webrat
This patch solved all my timeout problems. I have a test suite big
enough that it failed pretty much every time with the error "ed out
after 0ms". Drove me nuts since it failed at completely different
places every time. The "Tim" on the error message got trimmed off by
the crazy horrible code within the http_post method in selenium-
client, but that's another story. After adding the patch, I ran my
entire test suite a dozen times in a row and it worked every time.

By the way, if you need this fixed now (without the next webrat
version), go ahead and add a require for this temporary monkey patch
to your support/env.rb: http://gist.github.com/87679

Thanks a ton for solving this. Good work guys!


On Mar 29, 11:41 am, fwoeck <f...@bluemars.net> wrote:
> Hurray! It's a reported bug and there is already a working patch for
> it:https://webrat.lighthouseapp.com/projects/10503/tickets/205-patch-tim...

Venue Driver

Apr 23, 2009, 2:41:12 PM4/23/09
to webrat
I had the same exact problem that everybody else has been having with
this. I patched WebRat with the new code that
uses :timeout_in_seconds => 5. Now my problem is that it still times
out, and it still gives the same error. It's just that now it does it
after 5000ms instead of after 0ms.

Here's an example, from one of the features for Clearance:

Scenario: User is not signed up #
Given no user exists with an email of "em...@person.com" #
When I go to the sign in page #
And I sign in as "em...@person.com/password" #
ed out after 5000ms (Selenium::CommandError)
ruby/1.8/timeout.rb:56:in `timeout'
ruby/1.8/timeout.rb:76:in `timeout'
(eval):2:in `click_button'
./features/step_definitions/webrat_steps.rb:15:in `/^I press "([^
features/sign_in.feature:9:in `And I sign in as
Then I should see "Bad email or password" #
And I should not be signed in #

Ordinary WebRat actions like "visit" are working, and response.should
contain(text) seems to work. But anything that clicks, fills out
things, etc, just doesn't work.

Does anybody know where I can look for more information about what
went wrong? Is there some kind of log somewhere with more detail
about what Selenium is trying to do? There are so many things that
work in WebRat that don't work with Selenium (response.headers,
redirected_to, etc, etc) and then the things that should work don't
work and don't give much of an indication as to why. I'm about to
just give up on Selenium.
Reply all
Reply to author
0 new messages