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

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

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

WebClient.setCurrentWindow介绍

[英]Sets the "current" window for this client. This is the window that will be used when getPage(...) is called without specifying a window.
[中]设置此客户端的“当前”窗口。这是getPage(…)时将使用的窗口在不指定窗口的情况下调用。

代码示例

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

private void setMainWindow(WebWindow win) {
 wc.setCurrentWindow(win);
 this.win = win;
}

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

/**
 * Sets the focus to this element.
 */
public void jsxFunction_focus() {
  webWindow_.getWebClient().setCurrentWindow(webWindow_);
}

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

/**
 * Sets the focus to this element.
 */
public void jsxFunction_focus() {
  webWindow_.getWebClient().setCurrentWindow(webWindow_);
}

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

/**
 * Sets the focus to this element.
 */
public void jsxFunction_focus() {
  webWindow_.getWebClient().setCurrentWindow(webWindow_);
}

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

webClient_.setCurrentWindow(newWindow);
  webClient_.setCurrentWindow(
      webClient_.topLevelWindows_.get(webClient_.topLevelWindows_.size() - 1));
webClient_.setCurrentWindow(null);
webClient_.setCurrentWindow(
    webClient_.topLevelWindows_.get(webClient_.topLevelWindows_.size() - 1));

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

webClient_.setCurrentWindow(newWindow);
  webClient_.setCurrentWindow(
      webClient_.topLevelWindows_.get(webClient_.topLevelWindows_.size() - 1));
webClient_.setCurrentWindow(null);
webClient_.setCurrentWindow(
    webClient_.topLevelWindows_.get(webClient_.topLevelWindows_.size() - 1));

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

private WebDriver finishSelecting(WebWindow window) {
 getWebClient().setCurrentWindow(window);
 currentWindow = window;
 pickWindow();
 return HtmlUnitDriver.this;
}

代码示例来源: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.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: net.sourceforge.htmlunit/htmlunit

/**
 * Sets the focus to this element.
 */
@JsxFunction
public void focus() {
  final WebWindow window = getWebWindow();
  window.getWebClient().setCurrentWindow(window);
}

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

public WebDriver window(String windowId) {
  WebWindow window;
  try {
     window = webClient.getWebWindowByName(windowId);
  } catch (WebWindowNotFoundException e) {
    throw new NoSuchWindowException("Cannot find window: " + windowId);
  }
  webClient.setCurrentWindow(window);
  pickWindow();
  return HtmlUnitDriver.this;
}

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

/**
 * Sets the focus to this element.
 */
@JsxFunction
public void focus() {
  final WebWindow window = getWebWindow();
  window.getWebClient().setCurrentWindow(window);
}

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

setCurrentWindow(window);

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

setCurrentWindow(window);

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

setCurrentWindow(window);

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

/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings("unchecked")
public <P extends Page> P click(final Event event, final boolean ignoreVisibility) throws IOException {
  final boolean ctrl = event.isCtrlKey();
  WebWindow oldWebWindow = null;
  if (ctrl) {
    oldWebWindow = ((HTMLElement) event.getSrcElement()).getDomNodeOrDie()
        .getPage().getWebClient().getCurrentWindow();
  }
  P page = super.click(event, ignoreVisibility);
  if (ctrl) {
    page.getEnclosingWindow().getWebClient().setCurrentWindow(oldWebWindow);
    page = (P) oldWebWindow.getEnclosedPage();
  }
  return page;
}

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

/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings("unchecked")
public <P extends Page> P click(final Event event, final boolean ignoreVisibility) throws IOException {
  final boolean ctrl = event.isCtrlKey();
  WebWindow oldWebWindow = null;
  if (ctrl) {
    oldWebWindow = ((HTMLElement) event.getSrcElement()).getDomNodeOrDie()
        .getPage().getWebClient().getCurrentWindow();
  }
  P page = super.click(event, ignoreVisibility);
  if (ctrl) {
    page.getEnclosingWindow().getWebClient().setCurrentWindow(oldWebWindow);
    page = (P) oldWebWindow.getEnclosedPage();
  }
  return page;
}

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

webClient_.setCurrentWindow(window);

相关文章

WebClient类方法