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

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

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

WebClient.setPromptHandler介绍

[英]Sets the handler that will be executed when the JavaScript method Window.prompt() is called.
[中]设置JavaScript方法窗口打开时将执行的处理程序。调用prompt()。

代码示例

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

@Override
@PublicAtsApi
public void clickCancel() {
  isProcessed = false;
  webClient.setPromptHandler(new PromptHandler() {
    @Override
    public String handlePrompt(
                  Page currentPage,
                  String promptText,
                  String defaultValue ) {
      isProcessed = true;
      return null;
    }
  });
}

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

@Override
@PublicAtsApi
public void clickOk(
           final String promptValue ) {
  isProcessed = false;
  webClient.setPromptHandler(new PromptHandler() {
    @Override
    public String handlePrompt(
                  Page currentPage,
                  String promptText,
                  String defaultValue ) {
      isProcessed = true;
      return promptValue;
    }
  });
}

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

@Override
@PublicAtsApi
public void clickOk(
           final String expectedText,
           final String promptValue ) {
  isProcessed = false;
  webClient.setPromptHandler(new PromptHandler() {
    @Override
    public String handlePrompt(
                  Page currentPage,
                  String promptText,
                  String defaultValue ) {
      isProcessed = true;
      if (!promptText.equals(expectedText)) {
        throw new VerificationException("The expected prompt text was: '" + expectedText
                        + "', but actually it is: '" + promptText + "'");
      }
      return promptValue;
    }
  });
}

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

@Override
@PublicAtsApi
public void clickCancel(
             final String expectedText ) {
  isProcessed = false;
  webClient.setPromptHandler(new PromptHandler() {
    @Override
    public String handlePrompt(
                  Page currentPage,
                  String promptText,
                  String defaultValue ) {
      isProcessed = true;
      if (!promptText.equals(expectedText)) {
        throw new VerificationException("The expected prompt text was: '" + expectedText
                        + "', but actually it is: '" + promptText + "'");
      }
      return null;
    }
  });
}

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

wc.setPromptHandler(new PromptHandler() {
 @Override
 public String handlePrompt(Page page, String msg) {

相关文章

WebClient类方法