本文整理了Java中com.gargoylesoftware.htmlunit.WebClient.closeAllWindows()
方法的一些代码示例,展示了WebClient.closeAllWindows()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.closeAllWindows()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebClient
类名称:WebClient
方法名:closeAllWindows
[英]Closes all opened windows, stopping all background JavaScript processing.
[中]关闭所有打开的窗口,停止所有后台JavaScript处理。
代码示例来源:origin: com.atlassian.integrationtesting/atlassian-integrationtesting-lib
public void closeWindows()
{
webClient.closeAllWindows();
}
代码示例来源:origin: com.atlassian.integrationtesting/atlassian-integrationtesting-lib
public void destroy()
{
webClient.closeAllWindows();
}
代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-htmlunit
public void quit() {
webClient.closeAllWindows();
webClient = null;
currentWindow = null;
histories.clear();
}
代码示例来源:origin: org.apache.myfaces.extensions.cdi.test/myfaces-extcdi-cargo-support-module
/**
* {@inheritDoc}
*/
@Override
//@After
public void after()
{
super.after();
webClient.closeAllWindows();
webClient = null;
}
代码示例来源:origin: org.apache.myfaces.extensions.cdi.test/myfaces-extcdi-cargo-support-module
/**
* {@inheritDoc}
*/
@Override
//@After
public void after()
{
webClient.closeAllWindows();
webClient = null;
ViewConfigCache.reset();
}
}
代码示例来源:origin: stackoverflow.com
@Test
public void homePage_Firefox() throws Exception {
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17);
final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");
Assert.assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());
webClient.closeAllWindows();
}
代码示例来源:origin: stackoverflow.com
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class Test {
public static void main(String[] args) {
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_24);
HtmlPage page = null;
try {
page = webClient.getPage("https://docs.angularjs.org/api/ng/service/$http");
} catch (Exception e) {}
System.out.println(page.asXml());
webClient.closeAllWindows();
}
}
代码示例来源:origin: stackoverflow.com
protected void closeWebClient(WebClient wc) {
List<WebWindow> windows = wc.getWebWindows();
for (WebWindow wd : windows) {
// wd.getThreadManager().interruptAll();
wd.getJobManager().removeAllJobs();
}
wc.closeAllWindows();
}
代码示例来源:origin: stackoverflow.com
@Test
public void homePage_proxy() throws Exception {
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_2, "http://myproxyserver", myProxyPort);
//set proxy username and password
final DefaultCredentialsProvider credentialsProvider = (DefaultCredentialsProvider) webClient.getCredentialsProvider();
credentialsProvider.addProxyCredentials("username", "password");
final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");
assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());
webClient.closeAllWindows();
}
代码示例来源:origin: stackoverflow.com
WebClient webClient = new WebClient(BrowserVersion.CHROME_16);
HtmlPage page = webClient.getPage("http://www.theocc.com/webapps/position-limits");
HtmlAnchor anchor = null;
List<HtmlAnchor> anchors = page.getAnchors();
for (int i = 0; i < anchors.size(); ++i)
{
anchor = anchors.get(i);
String sAnchor = anchor.asText();
// This date should come in from args
if (sAnchor.equals("July 9, 2013"))
break;
}
// This is not safe, need null check
Page p = anchor.click();
InputStream is = p.getWebResponse().getContentAsStream();
int b = 0;
while ((b = is.read()) != -1)
{
System.out.print((char)b);
}
webClient.closeAllWindows();
代码示例来源:origin: stackoverflow.com
webClient.closeAllWindows();
out.println(staticSnapshotHtml);
webClient.closeAllWindows();
out.println("");
out.flush();
代码示例来源:origin: stackoverflow.com
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
webClient.setJavaScriptEnabled(true);
webClient.getCookieManager().setCookiesEnabled(true);
try{ final HtmlPage page1 = webClient.getPage("http://www.ccstechnologies.org/login.aspx/");
final HtmlForm form = page1.getFormByName("form1");
final HtmlSubmitInput button = form.getInputByName("BtnLogin");
final HtmlTextInput textField = form.getInputByName("Username");
final HtmlPasswordInput pwd = form.getInputByName("password");
textField.setValueAttribute("username");
pwd.setValueAttribute("password");
System.out.println(page1.asText());
final HtmlPage page2 = (HtmlPage) form.getInputByValue("Login").click();
String htmlBody = page2.getWebResponse().getContentAsString();
System.out.println(page2.asText());
System.out.println("Base Uri 1 : "+page1);
System.out.println("Base Uri 2 : "+page2);
webClient.closeAllWindows();}catch (Exception e) {
// TODO: handle exception
}
代码示例来源:origin: com.gwtplatform/gwtp-crawler-service
webClient.closeAllWindows();
代码示例来源:origin: ArcBees/GWTP
webClient.closeAllWindows();
代码示例来源:origin: stackoverflow.com
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_24);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.setCssErrorHandler(new SilentCssErrorHandler());
webClient.getOptions().setCssEnabled(true);
webClient.getOptions().setRedirectEnabled(true);
webClient.getOptions().setAppletEnabled(false);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setPopupBlockerEnabled(true);
webClient.getOptions().setTimeout(10000);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);
webClient.getOptions().setThrowExceptionOnScriptError(true);
webClient.getOptions().setPrintContentOnFailingStatusCode(true);
webClient.waitForBackgroundJavaScript(5000);
try {
HtmlPage page = webClient.getPage(URL);
System.out.println(page.asText());
} catch (Exception e) {
e.printStackTrace();
}
webClient.closeAllWindows();
代码示例来源:origin: stackoverflow.com
System.out.println("2nd Page : "+page.asText());
webClient.closeAllWindows();
内容来源于网络,如有侵权,请联系作者删除!