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

x33g5p2x  于2022-02-02 转载在 JavaScript  
字(2.8k)|赞(0)|评价(0)|浏览(170)

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

WebClient.setJavaScriptErrorListener介绍

[英]Sets the javascript error listener for this webclient. When setting to null, the DefaultJavaScriptErrorListener is used.
[中]

代码示例

代码示例来源:origin: jenkinsci/jenkins-test-harness

/**
 * Create and add an {@link ExceptionListener} to the {@link WebClient} instance.
 * @param webClient The {@link WebClient} instance.
 * @return The {@link ExceptionListener}.
 */
public static ExceptionListener addExceptionListener(WebClient webClient) {
  ExceptionListener exceptionListener = new ExceptionListener(webClient);
  webClient.setJavaScriptErrorListener(exceptionListener);
  return exceptionListener;
}

代码示例来源:origin: com.github.seykron/htmlunit-maven-plugin

/** Initializes the web client to wait for, registering opened windows and
 * listening for new windows.
 * @param theClient Web client to wait. Cannot be null.
 */
private void initialize(final WebClient theClient) {
 theClient.addWebWindowListener(webWindowListener);
 theClient.getOptions().setThrowExceptionOnScriptError(false);
 theClient.setJavaScriptErrorListener(javaScriptErrorListener);
 for (WebWindow webWindow : theClient.getWebWindows()) {
  if (!windows.contains(webWindow)
    && webWindow.getScriptObject() != null) {
   windows.add(webWindow);
  }
 }
}

代码示例来源: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;
}

代码示例来源:origin: net.wetheinter/gwt-user

webClient.setJavaScriptErrorListener(new JavaScriptErrorListener() {

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

webClient.setJavaScriptErrorListener(new JavaScriptErrorListener() {

相关文章

微信公众号

WebClient类方法