How to fill hidden field with Capybara?
You need to locate the hidden field and set its value. There are a couple ways, this is probably the simplest
find(:xpath, "//input[@id='my_hidden_field_id']").set "my value"
If you're executing a client_side script in production, you could just tell capybara to run it with a javascript-compliant driver
page.execute_script("$('hidden_field_id').my_function()")
There are many ways to achieve the same result. The one I like the most is:
first('input#id.class', visible: false).set("your value")
This is what worked for me
find_field(id: 'your_hidden_field_id', type: :hidden).set('Field value here')
If you're using poltergeist/phantomjs as a driver and jquery isn't working for ya, there's always good old fashioned js:
page.execute_script("document.getElementById('#some-id').value = 'some-value'");