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

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

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

WebClient.createJavaScriptEngineIfPossible介绍

[英]Creates a JavaScript engine if possible.
[中]如果可能,创建一个JavaScript引擎。

代码示例

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

/**
 * Generic initialization logic used by all constructors. This method does not perform any
 * parameter validation; such validation must be handled by the constructors themselves.
 * @param browserVersion the browser version to simulate
 * @param proxyConfig the proxy configuration to use
 */
private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) {
  homePage_ = "http://www.gargoylesoftware.com/";
  browserVersion_ = browserVersion;
  proxyConfig_ = proxyConfig;
  try {
    scriptEngine_ = createJavaScriptEngineIfPossible(this);
  }
  catch (final NoClassDefFoundError e) {
    scriptEngine_ = null;
  }
  // The window must be constructed AFTER the script engine.
  addWebWindowListener(new CurrentWindowTracker());
  currentWindow_ = new TopLevelWindow("", this);
  fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null));
}

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

/**
 * Generic initialization logic used by all constructors. This method does not perform any
 * parameter validation; such validation must be handled by the constructors themselves.
 * @param browserVersion the browser version to simulate
 * @param proxyConfig the proxy configuration to use
 */
private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) {
  homePage_ = "http://www.gargoylesoftware.com/";
  browserVersion_ = browserVersion;
  proxyConfig_ = proxyConfig;
  try {
    scriptEngine_ = createJavaScriptEngineIfPossible(this);
  }
  catch (final NoClassDefFoundError e) {
    scriptEngine_ = null;
  }
  // The window must be constructed AFTER the script engine.
  addWebWindowListener(new CurrentWindowTracker());
  currentWindow_ = new TopLevelWindow("", this);
  fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null));
}

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

/**
 * Generic initialization logic used by all constructors. This method does not perform any
 * parameter validation; such validation must be handled by the constructors themselves.
 * @param browserVersion the browser version to simulate
 * @param proxyConfig the proxy configuration to use
 */
private void init(final BrowserVersion browserVersion, final ProxyConfig proxyConfig) {
  homePage_ = "http://www.gargoylesoftware.com/";
  browserVersion_ = browserVersion;
  proxyConfig_ = proxyConfig;
  try {
    scriptEngine_ = createJavaScriptEngineIfPossible(this);
  }
  catch (final NoClassDefFoundError e) {
    scriptEngine_ = null;
  }
  // The window must be constructed AFTER the script engine.
  addWebWindowListener(new CurrentWindowTracker());
  currentWindow_ = new TopLevelWindow("", this);
  fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null));
}

相关文章

WebClient类方法