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?
I’ve always had the best luck with HTMLUnit. It uses apache http and handles all the interaction pretty intuitively.