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

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

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

WebClient.getOnbeforeunloadHandler介绍

[英]Returns the onbeforeunload handler for this webclient.
[中]返回此webclient的onbeforeunload处理程序。

代码示例

代码示例来源:origin: org.jenkins-ci/htmlunit

private boolean isOnbeforeunloadAccepted(final HtmlPage page, final Event event) {
  if (event.jsxGet_type().equals(Event.TYPE_BEFORE_UNLOAD) && event.jsxGet_returnValue() != null) {
    final OnbeforeunloadHandler handler = getWebClient().getOnbeforeunloadHandler();
    if (handler == null) {
      if (LOG.isWarnEnabled()) {
        LOG.warn("document.onbeforeunload() returned a string in event.returnValue,"
            + " but no onbeforeunload handler installed.");
      }
    }
    else {
      final String message = Context.toString(event.jsxGet_returnValue());
      return handler.handleEvent(page, message);
    }
  }
  return true;
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

private boolean isOnbeforeunloadAccepted(final HtmlPage page, final Event event) {
  if (event.jsxGet_type().equals(Event.TYPE_BEFORE_UNLOAD) && event.jsxGet_returnValue() != null) {
    final OnbeforeunloadHandler handler = getWebClient().getOnbeforeunloadHandler();
    if (handler == null) {
      if (LOG.isWarnEnabled()) {
        LOG.warn("document.onbeforeunload() returned a string in event.returnValue,"
            + " but no onbeforeunload handler installed.");
      }
    }
    else {
      final String message = Context.toString(event.jsxGet_returnValue());
      return handler.handleEvent(page, message);
    }
  }
  return true;
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

private boolean isOnbeforeunloadAccepted(final HtmlPage page, final Event event) {
  if (event.jsxGet_type().equals(Event.TYPE_BEFORE_UNLOAD) && event.jsxGet_returnValue() != null) {
    final OnbeforeunloadHandler handler = getWebClient().getOnbeforeunloadHandler();
    if (handler == null) {
      if (LOG.isWarnEnabled()) {
        LOG.warn("document.onbeforeunload() returned a string in event.returnValue,"
            + " but no onbeforeunload handler installed.");
      }
    }
    else {
      final String message = Context.toString(event.jsxGet_returnValue());
      return handler.handleEvent(page, message);
    }
  }
  return true;
}

代码示例来源:origin: HtmlUnit/htmlunit

private boolean isOnbeforeunloadAccepted(final HtmlPage page, final Event event) {
  if (event instanceof BeforeUnloadEvent) {
    final BeforeUnloadEvent beforeUnloadEvent = (BeforeUnloadEvent) event;
    if (beforeUnloadEvent.isBeforeUnloadMessageSet()) {
      final OnbeforeunloadHandler handler = getWebClient().getOnbeforeunloadHandler();
      if (handler == null) {
        if (LOG.isWarnEnabled()) {
          LOG.warn("document.onbeforeunload() returned a string in event.returnValue,"
              + " but no onbeforeunload handler installed.");
        }
      }
      else {
        final String message = Context.toString(beforeUnloadEvent.getReturnValue());
        return handler.handleEvent(page, message);
      }
    }
  }
  return true;
}

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

private boolean isOnbeforeunloadAccepted(final HtmlPage page, final Event event, final ScriptResult result) {
  if (event instanceof BeforeUnloadEvent) {
    final BeforeUnloadEvent beforeUnloadEvent = (BeforeUnloadEvent) event;
    if (beforeUnloadEvent.isBeforeUnloadMessageSet()) {
      final OnbeforeunloadHandler handler = getWebClient().getOnbeforeunloadHandler();
      if (handler == null) {
        LOG.warn("document.onbeforeunload() returned a string in event.returnValue,"
            + " but no onbeforeunload handler installed.");
      }
      else {
        final String message = Context.toString(beforeUnloadEvent.getReturnValue());
        return handler.handleEvent(page, message);
      }
    }
  }
  return true;
}

相关文章

WebClient类方法