Mechanize is a library for automated web browsing originally developed for Perl, there are now also Python and Ruby implementations.
Mechanize is a Ruby library for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history. It is adapted from the Perl www-mechanize module. There is also a mechanize-python for Python.