473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 1450

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

Similar topics

7
by: Anders S. Clausen | last post by:
Hi I have a jsp with a couple of <HTML:TEXTAREA> where I would like to dynamically size the textarea depending on the length of a String entered on a different jsp. The two new textareas are to...
18
by: Gr8DaddyG | last post by:
I am trying to paste the following code into the HTLM editor of my webpage: <script...
26
by: Dave Patton | last post by:
http://members.shaw.ca/davepatton/gps.html In another newsgroup(related to GPS), in regards to the above page, someone said:...
14
by: | last post by:
Hi! I'm looking for unit-testing tools for .NET. Somthing like Java has --> http://www.junit.org regards, gicio
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
72
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
7
by: Dave Keen | last post by:
Hi I am a relative newcomer and as usual I am stuck. My ASP.Net 2003 app has a page which shows data from a database plus an associated picture. I use an ASP image control sized to 300x300px. ...
5
by: Lee | last post by:
Hi, Using the propertygrid, is it possible to have a user selectable 'unit of measure' for a field. For example, I am looking at using a propertygrid for defining inputs into a calculation. ...
0
by: rupak | last post by:
I am using the xml file as given below <?xml version="1.0"?> <propertyfolio> <property_group description="abc"> <property ref="1" name="One"> <unit id="2147365895" /> ...
1
by: Stimp | last post by:
Hi all, I want to override the GridView control so that the only html output in the <tabledeclaration is: <table id="tableID"> I don't want the "border" or "rules" or "style" attributes to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.