public class ProgrammaticBrowser extends Object
MBFImage
, etc.Constructor and Description |
---|
ProgrammaticBrowser()
Default constructor.
|
ProgrammaticBrowser(BrowserDelegate delegate)
Construct with given delegate object.
|
Modifier and Type | Method and Description |
---|---|
com.trolltech.qt.webkit.QWebElementCollection |
findAllElements(String selectorQuery)
Get all DOM elements matching the given CSS selector
|
com.trolltech.qt.webkit.QWebElement |
findFirstElement(String selectorQuery)
Get the first DOM element corresponding to the given CSS selector
|
com.trolltech.qt.webkit.QWebElement |
getBody()
Get the BODY element of the loaded page
|
int |
getHeight()
Get the height of the browser.
|
String |
getHTML()
Get the HTML of the currently loaded page
|
String |
getURL()
Get the URL for the currently loaded page
|
int |
getWidth()
Get the width of the browser.
|
boolean |
load(String url)
Load the page with the given URL
|
boolean |
load(String url,
long timeout)
Load the page with the given URL
|
boolean |
load(URL url)
Load the page with the given URL
|
boolean |
load(URL url,
long timeout)
Load the page with the given URL
|
protected void |
loadFinished(boolean successful) |
boolean |
loadHTML(String html)
Load the given html string into the browser
|
protected void |
loadStarted() |
void |
mainLoop(long timeout)
Run the browsers main event loop for timeout milliseconds
|
MBFImage |
renderToImage()
Get a render of the page as an image
|
MBFImage |
renderToImage(int width,
int height)
Get a render of the page as an image
|
protected boolean |
waitForLoad() |
public ProgrammaticBrowser()
DefaultBrowserDelegate
,
so you wont see any dialogs, etc.public ProgrammaticBrowser(BrowserDelegate delegate)
delegate
- protected void loadStarted()
protected boolean waitForLoad()
protected void loadFinished(boolean successful)
public void mainLoop(long timeout)
timeout
- the running timepublic String getHTML()
public boolean load(URL url)
url
- the url to load.public boolean load(URL url, long timeout) throws TimeoutException
url
- the url to load.timeout
- the amount of time to wait for the page to load before failingTimeoutException
public boolean load(String url, long timeout) throws TimeoutException
url
- the url to load.timeout
- the amount of time to wait for the page to load before failingTimeoutException
public boolean load(String url)
url
- the url to load.public boolean loadHTML(String html)
html
- the html stringpublic com.trolltech.qt.webkit.QWebElement getBody()
public com.trolltech.qt.webkit.QWebElementCollection findAllElements(String selectorQuery)
selectorQuery
- the CSS selectorpublic com.trolltech.qt.webkit.QWebElement findFirstElement(String selectorQuery)
selectorQuery
- the CSS selectorpublic MBFImage renderToImage()
public MBFImage renderToImage(int width, int height)
width
- height
- public int getWidth()
public int getHeight()