void (@NotNull JBCefBrowserBase browser, @NotNull Runnable runnable) { CountDownLatch latch = new CountDownLatch(1); browser.getJBCefClient().addLoadHandler(new CefLoadHandlerAdapter() { @Override public void onLoadEnd(CefBrowser cefBrowser, CefFrame frame, int httpStatusCode) { System.out.println("onLoadEnd on " + browser + " for " + browser.getCefBrowser().getURL()); browser.getJBCefClient().removeLoadHandler(this, cefBrowser); latch.countDown(); } }, browser.getCefBrowser()); invokeAndWaitForLatch(latch, runnable); }