title: Java GUI to display webpages and return HTML
body: <p>I need a workflow like below:</p>
  
  <pre><code>// load xyz.com in the browser window
  // the browser is live, meaning users can interact with it
  browser.load("http://www.google.com");
  
  // return the HTML of the initially loaded page
  String page = browser.getHTML();
  
  // after some time
  // user might have navigated to a new page, get HTML again
  String newpage = browser.getHTML();
  </code></pre>
  
  <p>I am surprised to see how hard this is to do with Java GUIs such as JavaFX (<a href="http://lexandera.com/2009/01/extracting-html-from-a-webview/" rel="noreferrer">http://lexandera.com/2009/01/extracting-html-from-a-webview/</a>) and Swing.</p>
  
  <p>Is there some simple way to get this functionality in Java?</p>