Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Watir to scrape data from a website on a linux server without monitor?

Can I use Watir to scrape data from a website (AJAX used) but on a linux server without monitor? (linode.com) ?

like image 814
Radek Avatar asked Oct 05 '10 08:10

Radek


People also ask

What is Watir testing tool?

Watir (Web Application Testing in Ruby), pronounced as "Water" is an open source tool developed using Ruby which helps in automating web application no matter which language the application is written. The browsers supported are Internet Explorer, Firefox, Chrome, Safari, and Edge.

What is Watir WebDriver gem?

Watir-WebDriver (Watir is short for Web Application Testing in Ruby) is a Ruby gem which allows you to automate your browser (make it click a button, submit a form, wait for some text to appear before continuing, and so on).


1 Answers

There are several ways to do this:

  1. Use HtmlUnit, either Celerity or watir-webdriver (through the remote Selenium2/WebDriver server).

  2. Use a real browser + a virtual X server (Xvfb). I'd recommend using watir-webdriver's Firefox driver and the Headless gem for a simple way to control this from Ruby.

This is basically a tradeoff between speed and realism. Personally I'd go with #2 if the site has any complex JavaScript or invalid HTML, but both approaches could be worth investigation.

For the future, I'm keeping an eye on this project, which looks like a terrific idea.

like image 178
jarib Avatar answered Sep 30 '22 04:09

jarib