本文整理了Java中com.gargoylesoftware.htmlunit.WebClient.close()
方法的一些代码示例,展示了WebClient.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.close()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebClient
类名称:WebClient
方法名:close
[英]Closes all opened windows, stopping all background JavaScript processing.
[中]关闭所有打开的窗口,停止所有后台JavaScript处理。
代码示例来源:origin: konsoletyper/teavm
private void cleanUp() {
Page p = page.get();
if (p != null) {
p.cleanUp();
}
for (WebWindow window : webClient.get().getWebWindows()) {
window.getJobManager().removeAllJobs();
}
page.remove();
webClient.get().close();
webClient.remove();
}
代码示例来源:origin: javaee-samples/javaee7-samples
@After
public void tearDown() {
webClient.getCookieManager().clearCookies();
webClient.close();
}
代码示例来源:origin: com.github.albfernandez.test-jsf/jsf-test-scriptunit
protected void thearDownQunit(FrameworkMethod method, Object target) {
if(null != page){
webClient.close();
}
}
代码示例来源:origin: org.apache.camel/camel-linkedin-api
public void close() {
webClient.close();
}
代码示例来源:origin: USCDataScience/sparkler
public void close() {
if (driver != null) {
LOG.info("Closing the JS browser");
driver.close();
driver = null;
}
}
}
代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver
@Override
public void quit() {
if (webClient != null) {
alert.close();
webClient.close();
webClient = null;
}
currentWindow = null;
}
代码示例来源:origin: org.teavm/teavm-junit
private void cleanUp() {
page.get().cleanUp();
for (WebWindow window : webClient.get().getWebWindows()) {
window.getJobManager().removeAllJobs();
}
page.remove();
webClient.get().close();
webClient.remove();
}
代码示例来源:origin: org.glassfish.soteria.test/common
@After
public void tearDown() {
webClient.getCookieManager().clearCookies();
webClient.close();
}
代码示例来源:origin: javaee/security-soteria
@After
public void tearDown() {
webClient.getCookieManager().clearCookies();
webClient.close();
}
代码示例来源:origin: apache/jackrabbit-oak
protected void tearDown() throws Exception {
client.close();
tomcat.stop();
}
代码示例来源:origin: net.sourceforge.jwebunit/jwebunit-htmlunit-plugin
/**
* Close the browser and check that all expected Javascript alerts, confirms and
* prompts have been taken care of.
*/
@Override
public void closeBrowser() throws ExpectedJavascriptAlertException,
ExpectedJavascriptConfirmException,
ExpectedJavascriptPromptException {
if (wc != null) {
wc.close();
wc = null;
}
form = null; // reset current form
if (this.expectedJavascriptAlerts.size() > 0) {
throw new ExpectedJavascriptAlertException(
(expectedJavascriptAlerts.get(0))
.getMessage());
}
if (this.expectedJavascriptConfirms.size() > 0) {
throw new ExpectedJavascriptConfirmException(
(expectedJavascriptConfirms.get(0))
.getMessage());
}
if (this.expectedJavascriptPrompts.size() > 0) {
throw new ExpectedJavascriptPromptException(
(expectedJavascriptPrompts.get(0))
.getMessage());
}
}
代码示例来源:origin: occidere/MMDownloader
/**
* HtmlUnit을 이용한 HTML 코드 파싱.
*
* @param eachArchiveAddress 실제 만화가 담긴 아카이브 주소
* @return 성공 시 html 코드를 리턴
*/
private String getHtmlPageHtmlUnit(String eachArchiveAddress) throws Exception {
/* 필수! 로그 메세지 출력 안함 -> HtmlUnit 이용시 Verbose한 로그들이 너무 많아서 다 끔 */
java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
print.info("일반 연결 시도중...\n");
WebClient webClient = new WebClient();
webClient.getOptions().setRedirectEnabled(true);
WebRequest req = new WebRequest(new URL(eachArchiveAddress));
req.setHttpMethod(HttpMethod.POST);
req.setAdditionalHeader("User-Agent", UserAgent.getUserAgent());
req.setAdditionalHeader("Accept-Encoding", "gzip"); //20171126 gzip 추가
req.getRequestParameters().add(new NameValuePair("pass", PASSWORD)); //비밀번호 post 방식 전송
HtmlPage page = webClient.getPage(req);
//Html코드를 포함한 페이지 소스코드가 담길 스트링
String pageSource = page.asXml();
/** 여기도 페이지 파싱 실패 시 검증하는 코드 들어가야 됨 **/
webClient.close();
print.info("일반 연결 성공\n");
return pageSource;
}
代码示例来源:origin: zidoshare/Elise
} finally {
if (webClient != null) {
webClient.close();
代码示例来源:origin: xuxueli/xxl-crawler
} finally {
if (webClient != null) {
webClient.close();
内容来源于网络,如有侵权,请联系作者删除!