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

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

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

Window.getWebWindow介绍

[英]Returns the WebWindow associated with this Window.
[中]

代码示例

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

/**
 * Returns the {@code innerWidth}.
 * @return the {@code innerWidth}
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_window_ref28.html">Mozilla doc</a>
 */
@JsxGetter
public int getInnerWidth() {
  return getWebWindow().getInnerWidth();
}

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

/**
 * Sets the {@code outerWidth}.
 * @param width the {@code outerWidth}
 */
@JsxSetter
public void setOuterWidth(final int width) {
  getWebWindow().setOuterWidth(width);
}

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

/**
 * Sets the {@code innerHeight}.
 * @param height the {@code innerHeight}
 */
@JsxSetter
public void setInneHeight(final int height) {
  getWebWindow().setInnerHeight(height);
}

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

/**
 * Returns the live collection of frames contained by this window.
 * @return the live collection of frames contained by this window
 */
private HTMLCollection getFrames() {
  final HtmlPage page = (HtmlPage) getWebWindow().getEnclosedPage();
  return new HTMLCollectionFrames(page);
}

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

/**
 * Returns the value of the window's {@code name} property.
 * @return the value of the window's {@code name} property
 */
@JsxGetter
public String getName() {
  return getWebWindow().getName();
}

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

/**
 * Sets the {@code outerHeight}.
 * @param height the {@code outerHeight}
 */
@JsxSetter
public void setOuterHeight(final int height) {
  getWebWindow().setOuterHeight(height);
}

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

/**
 * Sets the value of the window's {@code name} property.
 * @param name the value of the window's {@code name} property
 */
@JsxSetter
public void setName(final String name) {
  getWebWindow().setName(name);
}

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

@Override public String get(final ComputedCSSStyleDeclaration style) {
    final Element element = style.getElement();
    if (element instanceof HTMLBodyElement) {
      return String.valueOf(element.getWindow().getWebWindow().getInnerHeight());
    }
    return style.getStyleAttribute(HEIGHT, true);
  }
});

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

/**
 * Returns the value of the {@code parent} property.
 * @return the value of the {@code parent} property
 */
@JsxGetter
public ScriptableObject getParent() {
  final WebWindow parent = getWebWindow().getParentWindow();
  return parent.getScriptableObject();
}

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

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

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

/**
 * {@inheritDoc}
 */
@Override
public String getClassName() {
  if (getWindow().getWebWindow() != null && getBrowserVersion().hasFeature(JS_BGSOUND_AS_UNKNOWN)) {
    return "HTMLUnknownElement";
  }
  return super.getClassName();
}

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

/**
 * {@inheritDoc}
 */
@Override
public String getClassName() {
  if (getWindow().getWebWindow() != null
      && getBrowserVersion().hasFeature(JS_SELECT_OPTIONS_HAS_SELECT_CLASS_NAME)) {
    return "HTMLSelectElement";
  }
  return super.getClassName();
}

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

/**
 * Returns the {@code length} property.
 * @return the {@code length} property
 */
@JsxGetter
public int getLength() {
  final WebWindow w = getWindow().getWebWindow();
  return w.getHistory().getLength();
}

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

/**
 * Returns the {@code state} property.
 * @return the {@code state} property
 */
@JsxGetter
public Object getState() {
  final WebWindow w = getWindow().getWebWindow();
  return w.getHistory().getCurrentState();
}

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

/**
 * JavaScript constructor.
 */
@JsxConstructor({CHROME, FF, EDGE})
public void jsConstructor() {
  final SgmlPage page = (SgmlPage) getWindow().getWebWindow().getEnclosedPage();
  final DomElement fake =
      HTMLParser.getFactory(HtmlImage.TAG_NAME).createElement(page, HtmlImage.TAG_NAME, new AttributesImpl());
  setDomNode(fake);
}

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

/**
 * JavaScript function "forward".
 */
@JsxFunction
public void forward() {
  try {
    getWindow().getWebWindow().getHistory().forward();
  }
  catch (final IOException e) {
    Context.throwAsScriptRuntimeEx(e);
  }
}

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

/**
 * Returns the {@code cookieEnabled} property.
 * @return the {@code cookieEnabled} property
 */
@JsxGetter
public boolean isCookieEnabled() {
  return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled();
}

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

/**
 * Cancels the current HTTP request.
 */
@JsxFunction
public void abort() {
  getWindow().getWebWindow().getJobManager().stopJob(jobID_);
  setState(STATE_UNSENT, Context.getCurrentContext());
}

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

/**
 * Returns whether the specified media is supported by the object that displays the document object.
 * @param media the media query
 * @return whether the specified media is supported or not
 */
@JsxFunction
public boolean matchMedium(final String media) {
  final CSSErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler();
  final MediaList mediaList = CSSStyleSheet.parseMedia(errorHandler, media);
  return CSSStyleSheet.isActive(this, mediaList);
}

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

/**
 * Gets the browser version currently used.
 * @return the browser version
 */
public BrowserVersion getBrowserVersion() {
  final DomNode node = getDomNodeOrNull();
  if (node != null) {
    return node.getPage().getWebClient().getBrowserVersion();
  }
  return getWindow().getWebWindow().getWebClient().getBrowserVersion();
}

相关文章

微信公众号