We have recently had problem where a collection of scenarios involving multiple consecutive ajax requests are failing sporadically with the following error:

Capybara::Webkit::NodeNotAttachedError (Capybara::Webkit::NodeNotAttachedError)
./features/step_definitions/patient_steps.rb:133:in `/^I should see the followin
g patient names in this order:$/'
features\searching_patients_index.feature:39:in `Then I should see the following
patient names in this order:'

The interesting part is that this error is only being thrown on a Windows machine.

The most typical responses to this problem have been:

enforcing some sort of sleep or wait_until (despite it's deprecation, we reverted to Capybara v.1.1.3 to try it still) but this has not helped.

we tried increasing the default Capybara wait time

we have tried a "wait until _ is visible" by checking if a particular piece of the DOM is visible (see below)

When(/^I wait until "(.*?)" is visible$/) do |selector|
page.has_css?("#{selector}", :visible => true)
end

Here is an example of one of the failing features:

Scenario: Searching and then sorting patients
When I search for "J"
And I wait until ".patient.odd" is visible
And I click on the "Name" header in the "patients" table
And I wait until ".patient.odd" is visible
Then I should see the following patient names in this order:
| names |
| Smith, John |
| Schmo, Jill |
Then the result content should not include "Drapper, Don"

We are using Ajax for both searching a table and sorting it by column, so we are testing if the searching persists when sorting, in this example.

Please let us know if we can provide any further context and thank you in advance for your help!