Html Code Getter Using Swt Browser
How I can get html-page code to String using SWT Broser? Display display = new Display(); Shell shell = new Shell(display); shell.setSize(100, 100); Browser brow
Solution 1:
The method you are searching for is: Browser#getText()
. Here is the important part of the javadoc:
Returns a string with HTML that represents the content of the current page.
So this would do the job:
String html = browser.getText();
System.out.println(html);
For your second question: You can close the shell by calling Shell#close()
. Here is the Javadoc:
Requests that the window manager close the receiver in the same way it would be closed when the user clicks on the "close box" or performs some other platform specific key or mouse combination that indicates the window should be removed.
Post a Comment for "Html Code Getter Using Swt Browser"