使用 HtmlUnit 我可以为网页获取此图像元素
<pre> <a onclick="return OnSubmitValidateSignUp();return ValidEmail();" id="lnkSave" tabindex="10" class="create" href="javascript:__doPostBack('lnkSave','')"></a> </pre>
使用
<i> HtmlAnchor button = (HtmlAnchor) currentPage.getByXPath("//* [@id=\"lnkSave\"]").get(0);
System.out.println(" anchor "+ button.getId());</i>
但是当我把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.<init>(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)
我怎么解决这个问题?