1

Using HtmlUnit i can get this Image element for a webpage

 <pre> <a onclick="return OnSubmitValidateSignUp();return ValidEmail();" id="lnkSave"    tabindex="10" class="create" href="javascript:__doPostBack('lnkSave','')"></a> </pre>

using

     <i> HtmlAnchor button = (HtmlAnchor) currentPage.getByXPath("//* [@id=\"lnkSave\"]").get(0);     
System.out.println(" anchor "+ button.getId());</i>

But when i put button.click(); following error occured.

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)

How can i solve this problem?

1 Answers1

0

this is a javascript issue. It seems you have some javascript attached to the OnClick event of the button. First try is to disable JS, if possible. Second try take a look at this answer: HtmlUnit is throwing Out Of Memory and maybe leaking memory, it might help.

Community
  • 1
  • 1
Mosty Mostacho
  • 42,742
  • 16
  • 96
  • 123