There is a web page from which I want to retrieve a certain string. In order to do so, I need to login, click some buttons, fill a text box, click another button - and then the string appears.
How can I write a java program to do that automatically? Are there any useful libraries for that purpose?
Thanks
The super simple way to do this is using HtmlUnit here:
http://htmlunit.sourceforge.net/
and what you want to do can be as simple as:
Take a look at the apache HttpClient project, or if you need to run Javascript on the page, try HttpUnit.
Yes:
java.net.URL#openConnection()
will allow you to make http requests and get the http responsesApache HttpComponents is a library that makes it easier to work with HTTP.
Try HtmlUnit
Example code for submiting form:
For more details check: http://htmlunit.sourceforge.net/gettingStarted.html
Well when you press a button usually you do a request via a HTTP POST method, so you should use HttpClient to handle request and HtmlParser to handle the response page with the string you need.