Wednesday, September 26, 2012

Using HTMLUnit (Webcrawler Libs) For Login Into A Website



Notes :
  • Note that my HTMLUnit example below is not a web crawler scenario, because we have to know first the specific structure and fields of the page of a website that we try to log.
  • Note that HTMLUnit consume lot of memory. It's better to use other mechanism (not a crawler libs) such as Apache HTTPClient to complete the same task.
Preparation :
  • First, download HTMLUnit jars in here: HTMLUnit 2.12 
  • Put all the jars into your project's classpath.

Website login page source (login.html) :

 
Login codes:
That' its. Hope MyNotes helps.

1 comment:

  1. Awesome stuff, This tutorial really helped me. Thank you.

    ReplyDelete