From: gopal <go...@eb...> - 2003-06-26 10:52:01
|
We need full javascript functionality to integrate with my = webapplication. I need to test few javascript support sites with htmlunit, if these = sites pass without any error that's great. Is HtmlUnit support full javascript functionality? Where can i find documentation/exmples for htmlunit use cases. When i run following code i am getting Exception: final WebClient webClient =3D new WebClient(); final URL url =3D new URL("http://mail.yahoo.com"); final HtmlPage page =3D (HtmlPage)webClient.getPage(url); System.out.println( "Welcome to HtmlUnit " + = page.getFormByName("login_form").getInputByName("login")); final HtmlForm form =3D page.getFormByName("login_form"); final HtmlSubmitInput button =3D = (HtmlSubmitInput)form.getInputByName(".save"); final HtmlTextInput textField22 =3D = (HtmlTextInput)form.getInputByName("login"); textField22.setValueAttribute("username"); final HtmlPasswordInput textField23 =3D = (HtmlPasswordInput)form.getInputByName("passwd"); textField23.setValueAttribute("pwd"); final HtmlPage page2 =3D (HtmlPage)button.click(); System.out.println(" PAGE :: " + page2.toString()); Exception in thread "main" = com.gargoylesoftware.htmlunit.ScriptException: The undefined value has = no properties. at = com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScr= iptEngine.java:1 99) at = com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(H= tmlPage.java:770 ) at = com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNee= ded(HtmlPage.jav a:900) at = com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)= at = com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322) at = com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242) at = com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:186) at Test.main(Test.java:10) Please, guide me if i am in wrong path. Thank's=20 Gopal |