469,267 Members | 979 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

Html Unit Error-StrictErrorReporter Error

Hi All,
Am new to using HTMLUnit.I wrote a sample code(to emulate opening of website google.com and enter a value say "html" in the text field and click the Search button) .The code is as follows

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequestSettings;
import com.gargoylesoftware.htmlunit.WebWindow;
import java.util.*;
import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.*;
import java.net.*;
import junit.framework.TestCase;

public class newhtmlunit extends TestCase {

public void testHomePage()
{
try
{
WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_6_0);
webClient.setThrowExceptionOnScriptError(false);
webClient.setThrowExceptionOnFailingStatusCode(fal se);
webClient.setRedirectEnabled(true);
webClient.setJavaScriptEnabled(true);

URL strurl = new URL("http://www.google.com");
System.out.println("Test msg"+strurl);
HtmlPage loginpage = (HtmlPage)webClient.getPage(strurl);
HtmlForm form = loginpage.getFormByName("f");
HtmlTextInput searchvalue=(HtmlTextInput)form.getInputByName("q" );
searchvalue.setValueAttribute("html");
System.out.println("The value is"+searchvalue.getValueAttribute());
form.submit("btnG");

}
catch(Exception e)
{
System.out.println("Exception msg is "+e);
}
}

}

However am getting the following error
com.gargoylesoftware.htmlunit.javascript.StrictErr orReporter error
[SEVERE: error: message=[syntax error] sourceName=[Window.eval()] line=[1] lineSource=[( )] lineOffset=[4]..........
[cat=System,part=256.6]: ======= EXCEPTION START ========
[Exception class=[org.mozilla.javascript.EvaluatorException]
com.gargoylesoftware.htmlunit.ScriptException: syntax error (Window.eval()#1)

The exception was very huge.Please let me know if you need to look into the whole exception.

Please let me know what am doing wrong here.
Jun 26 '07 #1
0 1337

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Anders S. Clausen | last post: by
18 posts views Thread by Gr8DaddyG | last post: by
26 posts views Thread by Dave Patton | last post: by
14 posts views Thread by | last post: by
5 posts views Thread by serge calderara | last post: by
72 posts views Thread by Jacob | last post: by
7 posts views Thread by Dave Keen | last post: by
5 posts views Thread by Lee | last post: by
reply views Thread by rupak | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.