@Override protected WebClient modifyWebClient(WebClient client) { WebClient modifiedClient = super.modifyWebClient(client); modifiedClient.getOptions().setThrowExceptionOnScriptError(false); modifiedClient.setCssErrorHandler(new SilentCssErrorHandler()); return modifiedClient; } }
@Override protected WebClient modifyWebClient(WebClient client) { WebClient modifiedClient = super.modifyWebClient(client); modifiedClient.getOptions().setThrowExceptionOnScriptError(false); modifiedClient.setCssErrorHandler(new SilentCssErrorHandler()); return modifiedClient; } }
webClient.setRedirectEnabled(false); webClient.setAjaxController(new SyncAllAjaxController()); webClient.setCssErrorHandler(new SilentCssErrorHandler());
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.setAjaxController(new SyncAllAjaxController()); webClient.setCssErrorHandler(new SilentCssErrorHandler());
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.setAjaxController(new SyncAllAjaxController()); webClient.setCssErrorHandler(new SilentCssErrorHandler());
webClient.setCssErrorHandler(new SilentCssErrorHandler());
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_24); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); webClient.setCssErrorHandler(new SilentCssErrorHandler()); webClient.getOptions().setCssEnabled(true); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setAppletEnabled(false); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setPopupBlockerEnabled(true); webClient.getOptions().setTimeout(10000); webClient.getOptions().setThrowExceptionOnFailingStatusCode(true); webClient.getOptions().setThrowExceptionOnScriptError(true); webClient.getOptions().setPrintContentOnFailingStatusCode(true); webClient.waitForBackgroundJavaScript(5000); try { HtmlPage page = webClient.getPage(URL); System.out.println(page.asText()); } catch (Exception e) { e.printStackTrace(); } webClient.closeAllWindows();
@Override protected WebClient modifyWebClient(WebClient client) { myClient = client; client.getCookieManager().setCookiesEnabled(true); client.getOptions().setJavaScriptEnabled(true); client.getOptions().setCssEnabled(true); client.getOptions().setPopupBlockerEnabled(false); client.setIncorrectnessListener(new SilentIncorrectnessListener()); client.setCssErrorHandler(new QuietCssErrorHandler()); client.setAjaxController(new NicelyResynchronizingAjaxController()); return client; } }
public static WebClient newInstance(final BrowserVersion version) { final WebClient client = new WebClient(version) { @Override public WebResponse loadWebResponse(final WebRequest webRequest) throws IOException { return new WebResponseProxy(super.loadWebResponse(webRequest)); } }; client.setIncorrectnessListener(quietIncorrectnessListener); client.setJavaScriptErrorListener(loggingJsErrorListener); client.setHTMLParserListener(quietHtmlParserListener); client.setCssErrorHandler(quietCssErrorHandler); client.getOptions().setJavaScriptEnabled(true); client.setAjaxController(new NicelyResynchronizingAjaxController()); client.getOptions().setThrowExceptionOnScriptError(false); client.getOptions().setThrowExceptionOnFailingStatusCode(false); client.getOptions().setPrintContentOnFailingStatusCode(false); client.setWebConnection(new HttpWebConnection(client) { @Override protected WebResponse newWebResponseInstance( final WebResponseData responseData, final long loadTime, final WebRequest request) { return new WebResponseProxy(super.newWebResponseInstance(responseData, loadTime, request)); } }); return client; }