From: Gael H. <gae...@ho...> - 2005-06-07 16:11:04
|
Hi, I tried HtmlUnit on a yahoo login page because I develop a tool that automates the forms' filling. Unfortunately when I call the getPage on a webClient, I've got this exception: ======= EXCEPTION START ======== Exception class=[org.mozilla.javascript.WrappedException] com.gargoylesoftware.htmlunit.ScriptException: Wrapped java.lang.IllegalArgumentException at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:293) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:719) at com.gargoylesoftware.htmlunit.javascript.host.Window$1.run(Window.java:277) at java.lang.Thread.run(Unknown Source) WrappedException: org.mozilla.javascript.WrappedException: Wrapped java.lang.IllegalArgumentException at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1776) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:191) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:456) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:3026) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149) at org.mozilla.javascript.Context.evaluateString(Context.java:1220) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:288) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:719) at com.gargoylesoftware.htmlunit.javascript.host.Window$1.run(Window.java:277) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException at java.lang.Thread.setPriority(Unknown Source) at com.gargoylesoftware.htmlunit.javascript.host.Window.jsxFunction_setTimeout(Window.java:298) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:174) ... 14 more Inside wrapped exception: java.lang.IllegalArgumentException at java.lang.Thread.setPriority(Unknown Source) at com.gargoylesoftware.htmlunit.javascript.host.Window.jsxFunction_setTimeout(Window.java:298) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:174) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:456) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:3026) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149) at org.mozilla.javascript.Context.evaluateString(Context.java:1220) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:288) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:719) at com.gargoylesoftware.htmlunit.javascript.host.Window$1.run(Window.java:277) at java.lang.Thread.run(Unknown Source) == CALLING JAVASCRIPT == GargoyleWrapper16() ======= EXCEPTION END ======== Here's the code: WebClient webClient = new WebClient(); HtmlPage pageCourrante = (HtmlPage)webClient.getPage( new URL("http://fr.search.yahoo.com/free/request" )); Is it possible to fill this form ? I found another problem with this web page: the submit button has the value "Ouvrir session" and it seems that Htmlunit doesn't succeed in finding this button when I use getInputByValue (the same with "Ouvrir session"). So I use getInputByName but it's weird. cordially, Gael |