Alex Rivera | Logout

Super-fast screen scraping techniques?

Asked 2009-02-26T08:30:18.143
12

I often find myself needing to do some simple screen scraping for internal purposes (i.e. a third party service I use only publishes reports via HTML). I have at least two or three cases of this now. I could use apache httpclient and create all the necessary screen scraping code but it takes a while. Here is my usual process:

  1. Open up Charles Proxy on the web site and see whats going on.
  2. Start writing some java code using Apache HttpClient, dealing with cookies, multiple requests
  3. use Jericho HTML to deal with parsing of the HTML.

I wish I could just "record my session" quickly and then parametrize the things that vary from session to session. Imagine just using Charles to grab all the request HTTP and then parametrize the relevant query string or post params. Voila I have a reusable http script.

Is there anything that does this already? I remember when I used to work at a big company there used to be a tool we used called Load Runner by Mercury Interactive that essentially had a nice way to record an http session and make it reusable (for testing purposes). That tool, unfortunately, is very expensive.

Edit
Report

3 Answers

3

I wish I could just "record my session" quickly and then parametrize the things that vary from session to session.

If you have Visual Studio test edition it's web test function does that exactly. If you aren't using VS or want a stand alone tool I have had great success with OpenSpan. It is more than just web, it does windows apps, and java!

answered 2009-02-26T11:46:06.317
2

Python and Perl both have a module called Mechanize (WWW::Mechanize for perl) that makes it easy to do browser behavior programmaticly (filling out forms, handling cookies, etc).

So, Python + BeautifulSoup (great html/xml parser) + mechanize (browser functions) = super easy/fast scraper

answered 2009-04-22T12:24:54.543
1

Using FireFox, it should be possible to implement much of it with its powerful support for addons and enhancements, however that wouldn't really mean to run "headless", but really be a real scripted browser. Also, I seem to recall having read that google's chrome browser uses a similar technique to do automated regression testing.

answered 2009-04-20T18:43:53.853

Your Answer