I want to use CefBrowser.executeJavaScript to call some JS operations after the page is loaded to close the pop-up windows.How do I determine if the web content has loaded?
- Code: Select all
String url = "https://blog.csdn.net/knighthood2001/article/details/124618877";
JBCefBrowser myBrowser = new JBCefBrowser(url);
CefBrowser cefBrowser = myBrowser.getCefBrowser();
// After the web content is loaded
cefBrowser.executeJavaScript("alert('hello world!');",cefBrowser.getURL(), 0);
cefBrowser.executeJavaScript(
"window.onload = document.querySelector('.open-app-weixin')?.click();",
cefBrowser.getURL(), 0);
basePane.add(myBrowser.getComponent(), BorderLayout.CENTER);