WebDriver driver = new HtmlUnitDriver() { @Override protected WebClient getWebClient() { WebClient c = super.getWebClient(); c.getCache().setMaxSize(0); return c; } };
/** * {@inheritDoc} */ @Override public void cleanUp() { if (getWebClient().getCache().getCachedResponse(webResponse_.getWebRequest()) == null) { webResponse_.cleanUp(); } }
/** * {@inheritDoc} */ @Override public void cleanUp() { if (getWebClient().getCache().getCachedResponse(webResponse_.getWebRequest()) == null) { webResponse_.cleanUp(); } }
final WebResponse fromCache = getCache().getCachedResponse(webRequest); if (fromCache != null) { return new WebResponseFromCache(fromCache, webRequest); final WebResponseData responseData = new WebResponseData(content, 200, "OK", compiledHeaders); final WebResponse webResponse = new WebResponse(responseData, webRequest, 0); getCache().cacheIfPossible(webRequest, webResponse, null); return webResponse;
final WebResponse fromCache = getCache().getCachedResponse(webRequest); if (fromCache != null) { return new WebResponseFromCache(fromCache, webRequest); final WebResponseData responseData = new WebResponseData(content, 200, "OK", compiledHeaders); final WebResponse webResponse = new WebResponse(responseData, webRequest, 0); getCache().cacheIfPossible(webRequest, webResponse, null); return webResponse;
/** * Cleans up this page. */ @Override public void cleanUp() { if (getEnclosingWindow().getWebClient().getCache().getCachedResponse(webResponse_.getWebRequest()) == null) { webResponse_.cleanUp(); } }
/** * Cleans up this page. */ @Override public void cleanUp() { if (getEnclosingWindow().getWebClient().getCache().getCachedResponse(webResponse_.getWebRequest()) == null) { webResponse_.cleanUp(); } }
try (final WebClient webClient = new WebClient(BrowserVersion.CHROME)) { // disable caching webClient.getCache().setMaxSize(0); // Get the first page final HtmlPage page1 = webClient.getPage(url); final HtmlForm form = page1.getFormByName(formName); final HtmlTextInput taxCodeTextField = form.getInputByName(taxCodeTextFieldName); HtmlCheckBoxInput checkboxInput = form.getInputByName(checkboxInputName); taxCodeTextField.type(taxCode); checkboxInput.click(); //wait a little Thread.sleep(2000); //get the main page HtmlPage page2 = (HtmlPage) webClient.getTopLevelWindows().get(0).getEnclosedPage(); HtmlSubmitInput confirmButton = page2.getFormByName(formName).getInputByName(confirmButtonName); final HtmlPage page3 = confirmButton.click(); System.out.println(page3.asText()); }
WebClient webClient = webClientProvider.get(); webClient.getCache().clear(); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(true);
WebClient webClient = webClientProvider.get(); webClient.getCache().clear(); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(true);
final Cache cache = client.getCache(); final Object fromCache = cache.getCachedObject(request); if (fromCache != null && fromCache instanceof CSSStyleSheet) {
final Cache cache = client.getCache();
final Cache cache = client.getCache(); final Object fromCache = cache.getCachedObject(request); if (fromCache != null && fromCache instanceof CSSStyleSheet) {
final Cache cache = client.getCache(); final Object fromCache = cache.getCachedObject(request); if (fromCache != null && fromCache instanceof CSSStyleSheet) {
final Cache cache = client.getCache();
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ @JsxGetter public CSSStyleSheet getSheet() { if (sheet_ != null) { return sheet_; } final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); final String css = style.getTextContent(); final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final org.w3c.dom.css.CSSStyleSheet cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getWebRequest() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new CSSStyleSheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new CSSStyleSheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ public Stylesheet jsxGet_sheet() { if (sheet_ != null) { return sheet_; } String css = ""; final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); if (style.getFirstChild() != null) { css = style.getFirstChild().asText(); } final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final CSSStyleSheet cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getRequestSettings() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new Stylesheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new Stylesheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ @JsxGetter public CSSStyleSheet getSheet() { if (sheet_ != null) { return sheet_; } final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); final String css = style.getTextContent(); final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final CSSStyleSheetImpl cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getWebRequest() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new CSSStyleSheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new CSSStyleSheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ public Stylesheet jsxGet_sheet() { if (sheet_ != null) { return sheet_; } String css = ""; final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); if (style.getFirstChild() != null) { css = style.getFirstChild().asText(); } final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final CSSStyleSheet cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getRequestSettings() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new Stylesheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new Stylesheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ public Stylesheet jsxGet_sheet() { if (sheet_ != null) { return sheet_; } String css = ""; final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); if (style.getFirstChild() != null) { css = style.getFirstChild().asText(); } final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final CSSStyleSheet cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getRequestSettings() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new Stylesheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new Stylesheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }