Try Selenium or Watij.
Both frameworks open a web-page in browser and manipulate page elements. They can click a page element, enter data to input field, get a text or HTML of a specified element, etc. Watij in addition to that can emulate javascript events directly.