How would I write code in Java to read a html page from the internet and execute javascript within it?

Steven asked: I need to connect to a web site, download the home page, then search for a particular link within.

I have achieved this, however the link I require is dynamically generated when the page loads using javascript, so my HTML parser in Java cannot see it.

If anyone knows how to load a HTML file [...]