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

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

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

WebWindowEvent.getWebWindow介绍

[英]Returns the web window that fired the event.
[中]返回触发事件的web窗口。

代码示例

代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver

@Override
public void webWindowContentChanged(WebWindowEvent event) {
 if (event.getWebWindow() != currentWindow) {
  return;
 }
 // Do we need to pick some new default content?
 switchToDefaultContentOfWindow(currentWindow);
}

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

/**
   * {@inheritDoc}
   */
  public void webWindowOpened(final WebWindowEvent event) {
    final WebWindow window = event.getWebWindow();
    if (window instanceof TopLevelWindow) {
      final TopLevelWindow tlw = (TopLevelWindow) event.getWebWindow();
      topLevelWindows_.push(tlw);
    }
    // page is not loaded yet, don't set it now as current window
  }
}

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

/**
   * {@inheritDoc}
   */
  public void webWindowOpened(final WebWindowEvent event) {
    final WebWindow window = event.getWebWindow();
    if (window instanceof TopLevelWindow) {
      final TopLevelWindow tlw = (TopLevelWindow) event.getWebWindow();
      topLevelWindows_.push(tlw);
    }
    // page is not loaded yet, don't set it now as current window
  }
}

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

/**
   * {@inheritDoc}
   */
  public void webWindowOpened(final WebWindowEvent event) {
    final WebWindow window = event.getWebWindow();
    if (window instanceof TopLevelWindow) {
      final TopLevelWindow tlw = (TopLevelWindow) event.getWebWindow();
      topLevelWindows_.push(tlw);
    }
    // page is not loaded yet, don't set it now as current window
  }
}

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

/**
   * {@inheritDoc}
   */
  @Override
  public void webWindowOpened(final WebWindowEvent event) {
    final WebWindow window = event.getWebWindow();
    if (window instanceof TopLevelWindow) {
      final TopLevelWindow tlw = (TopLevelWindow) window;
      webClient_.topLevelWindows_.add(tlw);
    }
    // Page is not loaded yet, don't set it now as current window.
  }
}

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

/**
   * {@inheritDoc}
   */
  @Override
  public void webWindowOpened(final WebWindowEvent event) {
    final WebWindow window = event.getWebWindow();
    if (window instanceof TopLevelWindow) {
      final TopLevelWindow tlw = (TopLevelWindow) window;
      webClient_.topLevelWindows_.add(tlw);
    }
    // Page is not loaded yet, don't set it now as current window.
  }
}

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

public void webWindowClosed(final WebWindowEvent event) {
  windows.remove(event.getWebWindow());
 }
};

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-htmlunit

public void webWindowClosed(WebWindowEvent webWindowEvent) {
    WebWindow window = webWindowEvent.getWebWindow();
    histories.remove(window);
    pickWindow();
  }
});

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

/** {@inheritDoc}
 */
public void webWindowContentChanged(final WebWindowEvent event) {
 WebWindow webWindow = event.getWebWindow();
 if (!windows.contains(webWindow)
   && webWindow.getScriptObject() != null) {
  windows.add(webWindow);
 }
}

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

/** Adds registered event listeners to the window.
 * {@inheritDoc}
 */
@Override
public void webWindowContentChanged(final WebWindowEvent event) {
 com.gargoylesoftware.htmlunit.javascript.host.Window window;
 window = (com.gargoylesoftware.htmlunit.javascript.host.Window) event
   .getWebWindow().getScriptObject();
 registerEventListeners(window);
 publishConfiguration(window);
}

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

@Override
 public void webWindowOpened(WebWindowEvent event) {
  String win = event.getWebWindow().getName();
  Page newPage = event.getNewPage();
  if (newPage instanceof HtmlPage) {
   logger.debug("Window {} opened : {}", win, ((HtmlPage) newPage).getTitleText());
  } else {
   logger.info("Window {} opened", win);
  }
 }
});

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

/**
 * {@inheritDoc}
 */
public void webWindowClosed(final WebWindowEvent event) {
  final WebWindow window = event.getWebWindow();
  if (window instanceof TopLevelWindow) {
    final TopLevelWindow tlw = (TopLevelWindow) event.getWebWindow();
    topLevelWindows_.remove(tlw);
    if (tlw.equals(getCurrentWindow())) {
      if (topLevelWindows_.isEmpty()) {
        // Must always have at least window, and there are no top-level windows left; must create one.
        final TopLevelWindow newWindow = new TopLevelWindow("", WebClient.this);
        topLevelWindows_.push(newWindow);
        setCurrentWindow(newWindow);
      }
      else {
        // The current window is now the previous top-level window.
        setCurrentWindow(topLevelWindows_.peek());
      }
    }
  }
  else if (event.getWebWindow() == getCurrentWindow()) {
    // The current window is now the last top-level window.
    setCurrentWindow(topLevelWindows_.peek());
  }
}
/**

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

/**
 * {@inheritDoc}
 */
public void webWindowClosed(final WebWindowEvent event) {
  final WebWindow window = event.getWebWindow();
  if (window instanceof TopLevelWindow) {
    final TopLevelWindow tlw = (TopLevelWindow) event.getWebWindow();
    topLevelWindows_.remove(tlw);
    if (tlw.equals(getCurrentWindow())) {
      if (topLevelWindows_.isEmpty()) {
        // Must always have at least window, and there are no top-level windows left; must create one.
        final TopLevelWindow newWindow = new TopLevelWindow("", WebClient.this);
        topLevelWindows_.push(newWindow);
        setCurrentWindow(newWindow);
      }
      else {
        // The current window is now the previous top-level window.
        setCurrentWindow(topLevelWindows_.peek());
      }
    }
  }
  else if (event.getWebWindow() == getCurrentWindow()) {
    // The current window is now the last top-level window.
    setCurrentWindow(topLevelWindows_.peek());
  }
}
/**

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-htmlunit

public void webWindowContentChanged(WebWindowEvent webWindowEvent) {
  WebWindow window = webWindowEvent.getWebWindow();
  if (waitingToLoad) {
    waitingToLoad = false;
    webClient.setCurrentWindow(window);
  }
  History history = histories.get(window);
  if (history == null) {
    history = new History(window);
    histories.put(window, history);
  }
  history.addNewPage(webWindowEvent.getNewPage());
}

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

/**
 * {@inheritDoc}
 */
public void webWindowClosed(final WebWindowEvent event) {
  final WebWindow window = event.getWebWindow();
  if (window instanceof TopLevelWindow) {
    final TopLevelWindow tlw = (TopLevelWindow) event.getWebWindow();
    topLevelWindows_.remove(tlw);
    if (tlw.equals(getCurrentWindow())) {
      if (topLevelWindows_.isEmpty()) {
        // Must always have at least window, and there are no top-level windows left; must create one.
        final TopLevelWindow newWindow = new TopLevelWindow("", WebClient.this);
        topLevelWindows_.push(newWindow);
        setCurrentWindow(newWindow);
      }
      else {
        // The current window is now the previous top-level window.
        setCurrentWindow(topLevelWindows_.peek());
      }
    }
  }
  else if (event.getWebWindow() == getCurrentWindow()) {
    // The current window is now the last top-level window.
    setCurrentWindow(topLevelWindows_.peek());
  }
}
/**

代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver

@Override
 public void webWindowClosed(WebWindowEvent event) {
  // Check if the event window refers to us or one of our parent windows
  // setup the currentWindow appropriately if necessary
  WebWindow curr = currentWindow;
  do {
   // Instance equality is okay in this case
   if (curr == event.getWebWindow()) {
    currentWindow = currentWindow.getTopWindow();
    return;
   }
   curr = curr.getParentWindow();
  } while (curr != currentWindow.getTopWindow());
 }
});

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

final WebWindow window = event.getWebWindow();
if (window instanceof TopLevelWindow) {
  webClient_.topLevelWindows_.remove(window);

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

@Override
public void webWindowClosed(WebWindowEvent event) {
 if (win == null || event.getOldPage().equals(win.getEnclosedPage())) {
  win = wc.getCurrentWindow();
  form = null;
 }
 String win = event.getWebWindow().getName();
 Page oldPage = event.getOldPage();
 String oldPageTitle = "no_html";
 if (oldPage instanceof HtmlPage) {
  oldPageTitle = ((HtmlPage) oldPage).getTitleText();
 }
 logger.debug("Window {} closed : {}", win, oldPageTitle);
}

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

@Override
public void webWindowContentChanged(WebWindowEvent event) {
 form = null;
 String winName = event.getWebWindow().getName();
 Page oldPage = event.getOldPage();
 Page newPage = event.getNewPage();
 String oldPageTitle = "no_html";
 if (oldPage instanceof HtmlPage) {
  oldPageTitle = ((HtmlPage) oldPage).getTitleText();
 }
 String newPageTitle = "no_html";
 if (newPage instanceof HtmlPage) {
  newPageTitle = ((HtmlPage) newPage).getTitleText();
 }
 logger.debug("Window \"{}\" changed : \"{}\" became \"{}", new Object[] {winName, oldPageTitle, newPageTitle});
}

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

final WebWindow window = event.getWebWindow();
boolean use = false;
if (window instanceof DialogWindow) {

相关文章