I need to use a headless browser (to set cookies, get a content of other websites and click buttons in this content) from Ruby on Rails app (in the main code, not in the tests).
I need a sample app which shows to use set of technologies together (so I don't have to figure it out on my own).
I am thinking about following stack.
Capybara ([url removed, login to view])
Poltergeist ([url removed, login to view])
PhantomJS as a headless browser ([url removed, login to view])
However, I would be happy if you can offer an alternative better stack.
My requirements are:
a) The main application should be in Ruby on Rails
b) The code should be able to set cookies, get content and click buttons on content
c) The code should work in headless browser (no visible browser should be started)
I need a sample Rails app which does following:
a) A user tries to access /URL1 and it should do following
Inject some cookie into Capybara
Use capybara to get /URL2
This /URL2 should redirect to /URL3 (I want to see how Capybara handles redirects)
The /URL3 should return some content including a button.
The code should click on the button
All these actions should be done synchronously (when a user opened /URL1).
I think, it make sense to implement /URL2 and /URL3 in Rails app. However, I am fine if you will fine any website which already have this pattern (some URL redirecting to another one which has a button).
I don't need a production quality code. I just need a sample. However, this sample should be reasonable (no crazy hacks).
I need this within several days from the moment when the project will be started.