0

I have a problem with Grails project.

I'm using HtmlUnit and I don't know why but Grails shows a Evaluator Exception.

The code is:

WebClient webClient = new WebClient();

webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setActiveXNative(true);
webClient.getOptions().setAppletEnabled(true);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setPopupBlockerEnabled(true);
webClient.getOptions().setRedirectEnabled(true);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setUseInsecureSSL(true);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());

HtmlPage currentPage = webClient.getPage(web);

System.out.println("TITULO" + currentPage.getTitleText());

and the error is:

URI: /SRL/busqueda/showProgress2

Class: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException

Message In order to define a property, getter public void com.gargoylesoftware.htmlunit.javascript.host.html.HTMLInsElement.setCite(java.lang.String) must have zero parameters or a single ScriptableObject parameter. (BusquedaService.groovy#48)

The line contains the error is: HtmlPage currentPage = webClient.getPage(web);

Any idea o suggestion? :(

angelo087
  • 51
  • 5
  • Looks like JS issues again. Check this [question](http://stackoverflow.com/questions/20315330/how-to-overcame-htmlunit-scriptexception) – Mosty Mostacho Dec 10 '13 at 16:29
  • I have the method `webClient.getOptions().setThrowExceptionOnScriptError(false);` but the exception don't supress. Also I have chosen the IE browser like you explain in the question. Other browsers (FF o Chrome) don't show this exception but don't execute the rest code, They have problems with Javascript :( – angelo087 Dec 12 '13 at 10:58
  • Other times, the exception tell me this message: `com.gargoylesoftware.htmlunit.javascript.host.css.CSSCharsetRule.setEncoding(java.lang.String)` Is it an error of JavaScript? It's unusual because for other webs I have the same error :( – angelo087 Dec 18 '13 at 12:09
  • Yes, that smells like a JS error too. HTMLUnit is a framework for automated testing... when used to webscraping it is really a mess. You'll have to end up performing the requests manually – Mosty Mostacho Dec 18 '13 at 14:25
  • Sorry, I don't understand you. What do you want with "requests manually"?? – angelo087 Dec 19 '13 at 11:22

0 Answers0