This pull-request fixes the random Capybara::Webkit::InvalidResponseError failure described in #550.
The problem is a kind of "time of check to time of use" issue. The current webkit checks the validity of node index before actual Node command.
But it could be broken in the following scenario:
Check node index atomically to prevent race condition
Add spec for NodeNotAttachedError
This looks great! One problem with NodeNotAttached is that it's not super informative to the user. Perhaps we could provide a more informative message to the user, e.g. "element at [index] no longer present in the DOM". Even better, providing an xpath to that element (though that may not be possible).
Tweak NodeNotAttachedError message
I tweaked error message as suggested by @mhoran .
I found another fix of my pull-request.
dragTo and equals command take a node index as an argument, but it isn't checked.
If an argument node index is invalid, NodeNotAttachedError should be raised.
Awesome work! Thanks for submitting.
I've rebased, squashed, and merged this as 6945ed5 on master. It will go out with the next release.