SWT Broserを使用してhtmlページのコードをStringに変換するにはどうすればよいですか?
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(100, 100);
Browser browser = new Browser(shell, SWT.NONE);
browser.setBounds(5, 75, 100, 100);
shell.open();
browser.setUrl("https://google.com");
String html = browser.getText(); //NOTHING!
while (!shell.isDisposed()) {
if (!display.readAndDispatch() && html == null) {
display.sleep();
}
}
display.dispose();
Syste.out.println(html); ////NOTHING!
では、どうすればhtmlを取得できますか?そして、最良の方法は、htmlコードの取得後に表示ウィンドウが閉じるときですか?