Reputation: 5055
I'm writing a program that interacts with a website automatically in Java. I figured out how to build and send GET/POST requests to simulate a click or form submit. But I encountered a link that runs a JavaScript function.
<a href="javascript:function()">Run</a>
function function()
{
document.myform.submit();
}
After clicking, the webpage is redirected to another URL. How do I simulate this behavior in Java?
Upvotes: 0
Views: 245
Reputation: 56
I've always had the best luck with HTMLUnit. It uses apache http and handles all the interaction pretty intuitively.
Upvotes: 2
Reputation: 32397
Use an existing library like Selenium or HttpClient to interact with a website.
Upvotes: 1