Webpage content selector using WebEngine
<p>I want to load web content from a site <em>URI</em> and use selectors to get some useful information. I tried <em>JSoup</em> which allows me to <a href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#select-java.lang.String-" rel="nofollow">select elements with a CSS Selector</a>. Unfortunately <em>Jsoup</em> doesn't work as a browser and doesn't parse Javascript or handles cookies. That's why I looked into using the <em>JavaFX WebEngine</em> which works as a browser. But The <em>WebEngine</em> class returns <a href="https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Document.html" rel="nofollow">Documents</a> which are very limited in selector possibilities compared to <em>JSoup</em>. The only selectors are by <em>Id</em> or by <em>Tag</em>.</p>

<p>Is there a clean way to use the WebEngine of JavaFX with more specialized selector possibilities? </p>

<p>Or are there other browser implementations in Java that allow for more specialized selections? The implementation should preferably be fast.</p>

<p>The best solution I can come up with for now is the following:</p>

<ol>
<li>Use <em>WebEngine</em> of <em>JavaFX</em> to get a <em>Document</em> object of which the Javascript is parsed.</li>
<li>Convert the <em>Document</em> to a <em>String</em> using a <em>Transformer</em>.</li>
<li>Pass this String as argument to a <em>JSoup</em> object and use their <em>CSS</em> selector capabilities.</li>
</ol>