使用HtmlUnit我可以为网页获取此Image元素
使用
HtmlAnchor button = (HtmlAnchor) currentPage.getByXPath("//* [@id=\"lnkSave\"]").get(0);
System.out.println(" anchor "+ button.getId());
但是当我发现button.click();后发生错误。
Sep 28, 2012 6:39:59 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'application/x-javascript'.
Exception in thread "JS executor for com.gargoylesoftware.htmlunit.WebClient@f27a6e" java.lang.OutOfMemoryError: Java heap space
at java.util.Hashtable.put(Hashtable.java:458)
at java.util.Properties.load0(Properties.java:392)
at java.util.Properties.load(Properties.java:341)
at java.util.PropertyResourceBundle.(PropertyResourceBundle.java:130)
at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2610)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1436)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1400)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1354)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1354)
我该如何解决这个问题?