Method Summary |
|
public void | addHostsToProxyBypass(String pattern) Any hosts matched by the specified regular expression pattern will bypass the configured proxy. |
public void | addRequestHeader(String name, String value) Set a header which will be sent up on EVERY request from this client. |
public void | addWebWindowListener(WebWindowListener listener) Add a listener for WebWindowEvent's. |
public void | assertionFailed(String message) Throw an exception with the specified message. |
public void | deregisterWebWindow(WebWindow webWindow) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Remove a web window from the list of available windows. |
protected URL | encodeUrl(URL url) Encodes illegal parameter in path or query string (if any) as done by browsers. |
public static URL | expandUrl(URL baseUrl, String relativeUrl) Expands a relative url relative to the specified base. |
public Map | getActiveXObjectMap() Return the active X object map for this webclient. |
public AjaxController | getAjaxController() |
public AlertHandler | getAlertHandler() Return the alert handler for this webclient. |
public BrowserVersion | getBrowserVersion() |
public Cache | getCache() |
public ConfirmHandler | getConfirmHandler() Return the confirm handler. |
public CredentialsProvider | getCredentialsProvider() Returns the credentials provider for this client instance. |
public WebWindow | getCurrentWindow() Return the "current" window for this client. |
public HTMLParserListener | getHTMLParserListener() Gets the configured listener for messages generated by the html parser. |
public String | getHomePage() Returns the client's current homepage. |
public static boolean | getIgnoreOutsideContent() |
public IncorrectnessListener | getIncorrectnessListener() Gets the current listener for encountered incorrectness (except HTML parsing messages that
are handled by the HTML parser listener). |
public JavaScriptEngine | getJavaScriptEngine() This method is intended for testing only - use at your own risk. |
final protected Log | getLog() |
public OnbeforeunloadHandler | getOnbeforeunloadHandler() Return the onbeforeunload handler for this webclient. |
public Page | getPage(WebWindow webWindow, WebRequestSettings parameters) Send a request to a server and return a Page that represents the
response from the server. |
public Page | getPage(WebWindow opener, String target, WebRequestSettings params) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Open a new web window and populate it with a page loaded by
WebClient.getPage(WebWindow,WebRequestSettings)
Parameters: opener - The web window that initiated the request. Parameters: target - The name of the window to be opened. |
public Page | getPage(String url) Convenient method to build an URL and load it into the current WebWindow
Parameters: url - The url of the new content. |
public Page | getPage(URL url) Convenient method to load a URL into the current WebWindow
Parameters: url - The url of the new content. |
public Page | getPage(WebRequestSettings request) |
public PageCreator | getPageCreator() Return the current page creator. |
public boolean | getPrintContentOnFailingStatusCode() Return true if the content of the resulting document will be printed to
the console in the event of a failing response code. |
public PromptHandler | getPromptHandler() Return the prompt handler. |
public RefreshHandler | getRefreshHandler() Return the current refresh handler or null if one has not been set. |
public ScriptPreProcessor | getScriptPreProcessor() Return the script pre processor for this webclient. |
public StatusHandler | getStatusHandler() Return the status handler for this webclient. |
public int | getTimeout() |
public synchronized WebConnection | getWebConnection() |
public WebWindow | getWebWindowByName(String name) Return the first
WebWindow that matches the specified name.
Parameters: name - The name to search for. |
public List | getWebWindows() Return an immutable list of open web windows (top windows or not). |
public String | guessContentType(File file) Tries to guess the content type of the file.
This utility could be located in an helper class but we can compare this functionality
for instance with the "Helper Applications" settings of Mozilla and therefore see it as a
property of the "browser". |
public void | initialize(WebWindow webWindow) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Initialize a new web window for JavaScript. |
public void | initialize(Page newPage) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Initialize a new page for JavaScript. |
public void | initializeEmptyWindow(WebWindow webWindow) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Initialize a new empty web window for JavaScript. |
public boolean | isCookiesEnabled() Returns true if cookies are enabled. |
public boolean | isJavaScriptEnabled() Returns true if JavaScript is enabled and the script engine was loaded successfully. |
public boolean | isPopupBlockerEnabled() Returns true if the popup window blocker is enabled. |
public boolean | isRedirectEnabled() Return whether or not redirections will be followed automatically on receipt of
a redirect status code from the server. |
public boolean | isThrowExceptionOnFailingStatusCode() Return true if an exception will be thrown in the event of a failing response code. |
public boolean | isThrowExceptionOnScriptError() Indicates if an exception should be thrown when a script execution fails
(the default) or if it should be caught and just logged to allow page
execution to continue. |
public WebResponse | loadWebResponse(WebRequestSettings webRequestSettings) |
public Page | loadWebResponseInto(WebResponse webResponse, WebWindow webWindow) Use the specified WebResponse to create a Page object which will then
get inserted into the WebWindow. |
public WebWindow | openWindow(URL url, String windowName) Open a new window with the specified name. |
public WebWindow | openWindow(URL url, String windowName, WebWindow opener) Open a new window with the specified name. |
public WebWindow | popFirstWindow() Return the "first" window for this client. |
public void | printContentIfNecessary(WebResponse webResponse) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Logs the response's content if its status code indicates a request failure and
WebClient.getPrintContentOnFailingStatusCode() returns true. |
public void | pushClearFirstWindow() Clear the first window for this client. |
public void | registerWebWindow(WebWindow webWindow) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Add a new web window to the list of available windows. |
public void | removeHostsFromProxyBypass(String pattern) Any hosts matched by the specified regular expression pattern will no longer bypass the configured proxy. |
public void | removeRequestHeader(String name) |
public void | removeWebWindowListener(WebWindowListener listener) Remove a listener for WebWindowEvent's. |
public void | setActiveXObjectMap(Map activeXObjectMap) Set the active X object map for this webclient. |
public void | setAjaxController(AjaxController newValue) |
public void | setAlertHandler(AlertHandler alertHandler) Set the alert handler for this webclient. |
public void | setCache(Cache cache) |
public void | setConfirmHandler(ConfirmHandler handler) Set the handler that will be executed when the javascript method Window.confirm() is called. |
public void | setCookiesEnabled(boolean enabled) Enable/disable cookie support. |
public void | setCredentialsProvider(CredentialsProvider credentialsProvider) Sets the credentials provider that will provide authentication information when
trying to access protected information on a web server. |
public void | setCurrentWindow(WebWindow window) Set the current window for this client. |
public void | setHTMLParserListener(HTMLParserListener listener) Defines a listener for messages generated by the html parser.
Note: If
WebClient.getIgnoreOutsideContent() returns false , the parser
will ignore closing <body> and <html> tags to be able to handle html content
incorrectly located after the end of the html file. |
public void | setHomePage(String homePage) Sets the client's homepage. |
public static void | setIgnoreOutsideContent(boolean ignoreOutsideContent) Set the flag on the HtmlParse to ignore the content that is outside of the BODY
and HTML tags. |
public void | setIncorrectnessListener(IncorrectnessListener listener) Returns the current HTML incorrectness listener. |
public void | setJavaScriptEnabled(boolean enabled) Enable/disable JavaScript support. |
public void | setJavaScriptEngine(JavaScriptEngine engine) This method is intended for testing only - use at your own risk. |
public void | setOnbeforeunloadHandler(OnbeforeunloadHandler onbeforeunloadHandler) Set the onbeforeunload handler for this webclient. |
public void | setPageCreator(PageCreator pageCreator) Set the object that will be used to create pages. |
public void | setPopupBlockerEnabled(boolean enabled) Enable/disable the popup window blocker. |
public void | setPrintContentOnFailingStatusCode(boolean enabled) Specify whether or not the content of the resulting document will be
printed to the console in the event of a failing response code.
Successful response codes are in the range 200-299. |
public void | setPromptHandler(PromptHandler handler) Set the handler that will be executed when the javascript method Window.prompt() is called. |
public void | setRedirectEnabled(boolean enabled) Set whether or not redirections will be followed automatically on receipt of
a redirect status code from the server. |
public void | setRefreshHandler(RefreshHandler handler) Set the handler to be used whenever a refresh is triggered. |
public void | setScriptPreProcessor(ScriptPreProcessor scriptPreProcessor) Set the script pre processor for this webclient. |
public void | setStatusHandler(StatusHandler statusHandler) Set the status handler for this webclient. |
public void | setThrowExceptionOnFailingStatusCode(boolean enabled) Specify whether or not an exception will be thrown in the event of a
failing status code. |
public void | setThrowExceptionOnScriptError(boolean newValue) Changes the behavior of this webclient when a script error occurs. |
public void | setTimeout(int timeout) Sets the timeout of the WebConnection. |
public void | setUseInsecureSSL(boolean useInsecureSSL) If set to true, the client will accept connections to any host, regardless of
whether they have valid certificates or not. |
public void | setWebConnection(WebConnection webConnection) Set the object that will resolve all url requests
This method is intended for unit testing HtmlUnit itself. |
public void | throwFailingHttpStatusCodeExceptionIfNecessary(WebResponse webResponse) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Throws a
FailingHttpStatusCodeException if the request's status code indicates a request
failure and
WebClient.isThrowExceptionOnFailingStatusCode() returns true. |