final StringBuffer sb = new StringBuffer();
int i = 0;
for (Iterator iter = webClient.getWebWindows().iterator(); iter.hasNext();) {
final WebWindow curWindow = (WebWindow) iter.next();
if (curWindow instanceof TopLevelWindow) {
final Page page = curWindow.getEnclosedPage();
if (i > 0)
sb.append("\n");
sb.append("index: " + i + ", name: >" + curWindow.getName() + "<");
if (page instanceof HtmlPage) {
sb.append(", title: >" + ((HtmlPage) page).getTitleText() + "<");
}
else {
sb.append(", " + page.getWebResponse().getContentType());
}
sb.append(", url: " + page.getWebResponse().getRequestUrl());
++i;
}
}
return sb.toString();
}