几个月前我遇到了类似的问题,我通过清除缓存来解决它。确保使用适当的变量。试试这段代码(纠正任何语法错误):
public static HtmlPage myGetPage(WebClient webClient, String url,
boolean clearCache) throws Exception {
if (clearCache) {
webClient.getCache().clear();
}
return webClient.getPage(url);
}
public void myMethod() {
WebClient webClient = new WebClient();
webClient.setJavaScriptEnabled(true);
String url = "http://stackoverflow.com/users/268273";
HtmlPage page = myGetPage(webClient, url, false); // We don't clear de cache
System.out.println(page.asXml()); // Should return original value
page = myGetPage(webClient, url, true); // We clear the cache
System.out.println(page.asXml()); // Should return the new value
}PS:当然,使用你的网址:)