When trying to use click_button on a button in a form, if you get this error:
undefined method `node_name' for nil:NilClass
Check that the button is inside a form. As in, the following code will cause this error:
<input type="submit" value="save" />
Moving the button to the inside of the form will fix the issue.