Maybe you could try beginAt("http://www.google.com"); directly, however it should work as you wrote also. Are you sure there is such a textfield named "q" ?
François On Fri, Jul 24, 2009 at 3:30 PM, Pranay Prabhat <prabhat.pra...@gmail.com>wrote: > Many Thanks for answers below. > > As far as any confusion with regards the source code , then i think we can > neglect those as of now because right now i am only trying to focus on a > standard jwebunit code which i shall be able to run. > > I have all the required jars in my class path which includes htmlunit-2.5 > and nekohtml 1.9.12. Secondly i am not sure whether we need to explicitly > specify the code for HTMLUnit plugin as i am not using Selenium Plugin and > therefore the jwebunit test should pick the HTMLUnit plugin by default. > > Even if i run a standard test class below : > > package xyz; > import net.sourceforge.jwebunit.util.TestingEngineRegistry; > import net.sourceforge.jwebunit.junit.WebTestCase; > public class ExampleWebTestCase extends WebTestCase { > > public void setUp() { > setTestingEngineKey(TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT); > getTestContext().setBaseUrl("http://www.google.com"); > } > > public void testSearch() throws Exception { > beginAt("/"); > setTextField("q", "htmlunit"); > submit("btnG"); > clickLinkWithText("HtmlUnit"); > assertTitleEquals("htmlunit - Welcome to HtmlUnit"); > assertLinkPresentWithText("Get started"); > } > } > > I face the problem :- > > junit] ------------- ---------------- --------------- > [junit] Testcase: > testSearch(com.bamnetworks.mobile.event.test.ExampleWebTes > tCase): Caused an ERROR > [junit] null > [junit] java.lang.NullPointerException > [junit] at > com.gargoylesoftware.htmlunit.javascript.host.Event.<init>(Ev > ent.java:280) > [junit] at > com.gargoylesoftware.htmlunit.javascript.host.Event.<init>(Ev > ent.java:267) > [junit] at > com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandl > ersIfNeeded(HtmlPage.java:1236) > > Please can you suggest what is the problem here. > > Many Thanks, > Pranay. > > On Thu, Jul 23, 2009 at 6:27 PM, Julien HENRY <henr...@yahoo.fr> wrote: > >> I second Francois concerning code source, even if I'm not sure this is >> the root cause of the given error, it will lead to future issues. >> >> ------------------------------ >> *De :* Fran coyy <franc...@gmail.com> >> *À :* Usage problems for JWebUnit <jwebunit-users@lists.sourceforge.net> >> *Envoyé le :* Jeudi, 23 Juillet 2009, 14h52mn 09s >> *Objet :* Re: [JWebUnit-users] Problem while running JwebUnit tests >> >> Also the setUp fonction must be something like this : >> >> public void setUp() { >> try { >> super.setUp(); >> } catch (Exception e) { >> >> } >> >> setTestingEngineKey(TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT); // use >> HtmlUnit >> } >> >> >> >> Francois >> >> >> >> On Thu, Jul 23, 2009 at 2:50 PM, Fran coyy <franc...@gmail.com> wrote: >> >>> Hello, >>> >>> I'm not sure it can help you, but my own tests are working like this : >>> >>> >>> public void testIdentification(String login, String password) { >>> beginAt(PropertyConfManager.getValue("URL_BASE")); >>> >>> assertFormPresent(PropertyConfManager.getValue("FORMULAIRE_IDENTIFICATION")); >>> >>> setTextField(PropertyConfManager.getValue("FORMULAIRE_IDENTIFICATION_LOGIN"), >>> login); >>> >>> setTextField(PropertyConfManager.getValue("FORMULAIRE_IDENTIFICATION_PASSWORD"), >>> password); >>> submit(); >>> } >>> >>> I think you don't need to create all these objects you're creating. >>> >>> >>> Good luck, >>> >>> Francois >>> >>> >>> On Thu, Jul 23, 2009 at 1:47 PM, Pranay Prabhat < >>> prabhat.pra...@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> Day before yesterday i was browsing through internet to find out the >>>> best possible testing framework for web applications in my project. I was >>>> really impressed by the postings in JwebUnit and tried to implement that >>>> rightaway in my projects. >>>> >>>> But i landed in a problem and was not able to come out of it for more >>>> than a day. >>>> >>>> I have put all the jars provided in the jwebunit-2.2-release.zip in my >>>> class path. I am running the below simple test case through ant 1.6.5. I >>>> always get the below error :- >>>> >>>> " [junit] unable to create HTML parser >>>> [junit] com.gargoylesoftware.htmlunit.ObjectInstantiationException: >>>> unable to create HTML parser" >>>> >>>> " [junit] Enclosed exception: org.xml.sax.SAXNotRecognizedException: >>>> Feature ' >>>> http://cyberneko.org/html/features/parse-noscript-content' is not >>>> recognized." >>>> >>>> >>>> >>>> The simple junit i am running is :- >>>> >>>> package xyz; >>>> >>>> import net.sourceforge.jwebunit.junit.WebTestCase; >>>> import net.sourceforge.jwebunit.junit.WebTester; >>>> >>>> >>>> public class ExampleWebTestCase extends WebTestCase { >>>> private WebTester tester; >>>> public void setUp() throws Exception { >>>> super.setUp(); >>>> tester = new WebTester(); >>>> tester.setBaseUrl(<<<my url>>>); >>>> } >>>> >>>> public void test1() { >>>> tester.beginAt("/"); >>>> tester.assertTextPresent("Group"); >>>> } >>>> } >>>> >>>> Any help will be highly appreciated. >>>> >>>> Thanks, >>>> Pranay. >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> JWebUnit-users mailing list >>>> JWebUnit-users@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/jwebunit-users >>>> >>>> >>> >> >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> JWebUnit-users mailing list >> JWebUnit-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jwebunit-users >> >> > > > ------------------------------------------------------------------------------ > > _______________________________________________ > JWebUnit-users mailing list > JWebUnit-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jwebunit-users > >
------------------------------------------------------------------------------
_______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users