Determine when JavaFX WebView has finished rendering


I want to use the JFX snapshot functionality as soon as the WebView has finished rendering. I can determine when the WebEngine has finished loading the page, but the worker will fire a State.SUCCEEDED before the WebView has finished rendering the page loaded by the worker.

I've tried webView.setVisible(true), webView.layout(), webView.requestLayout(), webView.autosize(), etc.

How can I determine when the pixels are displayed within the WebView? Alternatively, can I force the WebView to render and block until it is complete?

5/23/2017 12:02:08 PM

The JavaFX WebEngine which WebView uses allows calls from javascript to Java, so you could put a call to Java in the onload attribute of the page body. Check out the docs for WebEngine, especially the "Calling back to Java from JavaScript" section.

10/11/2012 2:05:36 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow