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 ([login to view URL])
Poltergeist ([login to view URL])
PhantomJS as a headless browser ([login to view URL])
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.
Hi
If it is all about accessing a site via PhantomJS then may I know why do you need CapyBara here? do you want to automate test writing as well? Also, is it necessary to do it in Ruby?
I have used PHantomJS alot in Python. PM me to discuss.
Hi,
Please correct me if my understanding is wrong
1. when a user visits URL1 of the Rails app from the his computer.
2. Then the Rails app will use Capybara to start a web browser on your Server machine (not on the user's machine), and open another URL2 of another web site, then go to URL3, click on a button on that page
3. Use a headless driver, like Poltergeist to do the same as Capybara
Please confirm if above is correct? it's doable for me.