Reputation: 2178
In an open page loaded frame:
<iframe id="wikipedia" src="http://en.wikipedia.org"></iframe>
Trying to get to the content:
Document document = webEngine.getDocument();
Element elementById = document.getElementById("wikipedia");
System.out.println(elementById.getTextContent());
But do not achieve results ...
Upvotes: 1
Views: 2510
Reputation: 179
The following code works fine with javafx2:
Document doc = webEngine.getDocument();
HTMLIFrameElement iframeElement = (HTMLIFrameElement) doc.getElementById("wikipedia");
Document iframeContentDoc = iframeElement.getContentDocument();
Element rootElement = iframeContentDoc.getDocumentElement();
System.out.println(rootElement.getTextContent());
Upvotes: 4