Using Java you can use the selenium framework. After writing a script, it opens the browser and "has a life of its own".
In principle, selenium is a framework for testing web GUI, but nothing prevents you from using it to automate tasks.
In the blog Dyego Costa and have the following example of how to use selenium, to get an idea of how easy it is. In the example he does a google search:
[TestMethod]
public void MeuTesteSuperMassaSoQueNao()
{
// Usando o firefox
IWebDriver driver = new FirefoxDriver();
// acessa a página do google
driver.Navigate().GoToUrl("http://www.google.com/");
// Vai no campo de busca, escreve "Cheese" e aperta enter
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("Cheese");
query.Submit();
// Configura um timeout
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
// Espera até o título da página tiver cheese, tá pronto (ou o timeout acontencer)
wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); });
// Essa parte é o teste - pode ignorar, já que tu não quer testar nada
driver.Title.Should().Contain("cheese");
// fecha o browser
driver.Quit();
}
If you prefer ruby, watir is very simple and nice to use.