Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.

In some cases (e.g. automation testing) you might need to block current thread execution and wait until web page is loaded completely. JxBrowser API provides functionality that allows doing it. The following sample code demonstrates how to load web page and wait until it's loaded completely: 

// Blocks current thread execution and waits until web page is loaded completely
Browser.invokeAndWaitFinishLoadingMainFrame(browser, new Callback<Browser>() {
    public void invoke(Browser value) {

 Note: use this method for loading web pages only.