Can you deploy Watir to Heroku to create HTML snapshots? If so, how?

I would like to generate HTML snapshots using Watir hosted on Heroku .

Google Full specification for creating AJAX applications Crawlable suggests using HTMLUnit ... see How do I create an HTML snapshot? point number 3.

HtmlUnit is a simple browser emulator without a browser; and unfortunately jRuby is not an option on Heroku. Therefore, HtmlUnit is excluded (as far as I know).

If you're curious, I have another question regarding HtmlUnit as a service hosted by Google App Engine ... Creating AJAX Crawlable Applications? How to create a simple web service in Google App Engine for creating HTML snapshots? ... still waiting for a validated example / answer.

+1
source share
4 answers

No. To start watir, you need a complete desktop environment. Heroku does not provide this to you.

You can use a service like Amazon EC2

+1
source

Yes, you can

Use Watir with PhantomJS, which is headless

browser = Watir::Browser.new :phantomjs 

To use PhantomJS on Heroku, you need to use Heroku PhantomJS buildpack

+14
source

Troelskin's answer is incorrect. There are ways to run "headless" browsers with Watir that do not require a "full working environment." Having said that, I don't know which method might be suitable for Heroku.

Other options for headless automation (if you're using Ruby): Mechanize with Open-Uri with (optionally) Nokogiri.

+3
source

Maybe you can use iMacros for Firefox? It can be launched through the command line and take full screenshots of web pages .

-2
source

Source: https://habr.com/ru/post/977180/


All Articles