Simulate a click on JavaScript function in Java
<p>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.</p>

<pre><code>&lt;a href="javascript:function()"&gt;Run&lt;/a&gt;
function function()
{
    document.myform.submit();
}
</code></pre>

<p>After clicking, the webpage is redirected to another URL.
How do I simulate this behavior in Java?</p>
