com.gargoylesoftware.htmlunit.WebClient.setCssErrorHandler()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(313)

本文整理了Java中com.gargoylesoftware.htmlunit.WebClient.setCssErrorHandler()方法的一些代码示例,展示了WebClient.setCssErrorHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.setCssErrorHandler()方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebClient
类名称:WebClient
方法名:setCssErrorHandler

WebClient.setCssErrorHandler介绍

[英]Sets the CSS error handler used by this web client when CSS problems are encountered.
[中]设置遇到CSS问题时此web客户端使用的CSS错误处理程序。

代码示例

代码示例来源:origin: org.jboss.windup.tests/test-util

@Override
  protected WebClient modifyWebClient(WebClient client) {
    WebClient modifiedClient = super.modifyWebClient(client);
    modifiedClient.getOptions().setThrowExceptionOnScriptError(false);
    modifiedClient.setCssErrorHandler(new SilentCssErrorHandler());
    return modifiedClient;
  }
}

代码示例来源:origin: windup/windup

@Override
  protected WebClient modifyWebClient(WebClient client) {
    WebClient modifiedClient = super.modifyWebClient(client);
    modifiedClient.getOptions().setThrowExceptionOnScriptError(false);
    modifiedClient.setCssErrorHandler(new SilentCssErrorHandler());
    return modifiedClient;
  }
}

代码示例来源:origin: stackoverflow.com

webClient.setRedirectEnabled(false);
webClient.setAjaxController(new SyncAllAjaxController());
webClient.setCssErrorHandler(new SilentCssErrorHandler());

代码示例来源:origin: ArcBees/GWTP

webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.setAjaxController(new SyncAllAjaxController());
webClient.setCssErrorHandler(new SilentCssErrorHandler());

代码示例来源:origin: com.gwtplatform/gwtp-crawler-service

webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.setAjaxController(new SyncAllAjaxController());
webClient.setCssErrorHandler(new SilentCssErrorHandler());

代码示例来源:origin: com.axway.ats.framework/ats-uiengine

webClient.setCssErrorHandler(new SilentCssErrorHandler());

代码示例来源:origin: stackoverflow.com

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();

代码示例来源:origin: com.synaptix.redpepper/redpepper-automation

@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;
  }
}

代码示例来源:origin: timurstrekalov/saga

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;
}

相关文章

WebClient类方法