I'm using rspec and capybara and would like to test a JSON response that I get in response to for example click_button. I understand that I can use :js => true but I would like to parse back the JSON that I get. I see that I can do something like:
get '/your/path', format: 'js'
Is there a way to do something like:
click_button('Save', format: 'js')
::JSON.parse(response)....
?
thx
The aim of browser elumation libraries like Selenium is to approach real browsers and allow emulating behavior of real users. Real users can't read responses to AJAX actions so browser emulation libraries don't give such ability. Also it will be quiet hard for Selenium guys to implement it.
There are several possibilities that you have: