httpunit-develop Mailing List for httpunit (Page 3)
Brought to you by:
russgold
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(12) |
Sep
(77) |
Oct
(48) |
Nov
(51) |
Dec
(50) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(64) |
Feb
(53) |
Mar
(62) |
Apr
(60) |
May
(90) |
Jun
(35) |
Jul
(86) |
Aug
(98) |
Sep
(88) |
Oct
(82) |
Nov
(85) |
Dec
(61) |
| 2002 |
Jan
(94) |
Feb
(121) |
Mar
(145) |
Apr
(80) |
May
(99) |
Jun
(93) |
Jul
(84) |
Aug
(90) |
Sep
(163) |
Oct
(179) |
Nov
(219) |
Dec
(125) |
| 2003 |
Jan
(133) |
Feb
(184) |
Mar
(270) |
Apr
(157) |
May
(157) |
Jun
(99) |
Jul
(136) |
Aug
(133) |
Sep
(113) |
Oct
(47) |
Nov
(64) |
Dec
(80) |
| 2004 |
Jan
(57) |
Feb
(82) |
Mar
(166) |
Apr
(80) |
May
(42) |
Jun
(96) |
Jul
(65) |
Aug
(76) |
Sep
(41) |
Oct
(155) |
Nov
(100) |
Dec
(64) |
| 2005 |
Jan
(84) |
Feb
(68) |
Mar
(38) |
Apr
(96) |
May
(69) |
Jun
(62) |
Jul
(50) |
Aug
(68) |
Sep
(52) |
Oct
(53) |
Nov
(39) |
Dec
(26) |
| 2006 |
Jan
(67) |
Feb
(41) |
Mar
(101) |
Apr
(60) |
May
(30) |
Jun
(24) |
Jul
(29) |
Aug
(18) |
Sep
(13) |
Oct
(9) |
Nov
(5) |
Dec
(13) |
| 2007 |
Jan
(17) |
Feb
(5) |
Mar
(16) |
Apr
(19) |
May
(3) |
Jun
(6) |
Jul
(2) |
Aug
(19) |
Sep
(14) |
Oct
(11) |
Nov
(18) |
Dec
(21) |
| 2008 |
Jan
(19) |
Feb
(5) |
Mar
(52) |
Apr
(84) |
May
(67) |
Jun
(15) |
Jul
(3) |
Aug
(10) |
Sep
(13) |
Oct
(4) |
Nov
(16) |
Dec
(7) |
| 2009 |
Jan
(4) |
Feb
(9) |
Mar
(6) |
Apr
(12) |
May
(9) |
Jun
(3) |
Jul
(5) |
Aug
(59) |
Sep
(17) |
Oct
(8) |
Nov
(3) |
Dec
(6) |
| 2010 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(6) |
Jun
|
Jul
(2) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
|
| 2011 |
Jan
(9) |
Feb
(1) |
Mar
(15) |
Apr
(3) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(3) |
Dec
(5) |
| 2012 |
Jan
|
Feb
(1) |
Mar
(3) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(5) |
Nov
(2) |
Dec
(1) |
| 2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Izzy A. <izz...@gm...> - 2011-03-25 19:26:31
|
If you're interested in automated *testing* of web applications with browser quirks and behavior in mind, I've heard really good things about Watir. If you're interested in automated access to web pages from java for something like data scraping, and if it was just for a particular website... I'd probably hack around the javascript requirements of the login page in question and just use curl or apache's HttpClient libraries instead (ah the heresy!). If you're interested in automated *rendering* of HTML pages from Java, I've had some success with the Lobo project's Cobra toolkit, but that project is pretty stagnant (and if you're C/C++ minded, run straight to WebKit!). Personally, I make extensive use of httpunit's ServletUnit functionality for unit testing servlets -- primarily for web-services and the like. The unit tests get run every time I build and they thoroughly exercise the servlets in an embedded servlet container. It's great! But I don't really ever find myself in need of the built in javascript features. This is a bit philosophical, but I consider Unit testing separate from Integration testing, and if you're testing on a live running server, it feels a lot more like integration testing to me... That's just my personal opinion though. Good luck! On Fri, Mar 25, 2011 at 2:31 PM, Dee Ayy <de...@gm...> wrote: > I'm trying httpunit because I am trying to login via script to a > website that I assume is running JavaScript as part of its > authentication method and I needed something to run the returned > JavaScript which CURL does not run. > > I got an error: > org.mozilla.javascript.EcmaError: TypeError: Cannot find function > addEventListener. (httpunit#19) > > Then noticed "addEventListener" is not listed here > http://httpunit.sourceforge.net/doc/javascript-support.html > > Then I added HttpUnitOptions per > http://httpunit.sourceforge.net/doc/faq.html#unsupported > and saw many more errors with the first displaying as: > failed: org.mozilla.javascript.EcmaError: TypeError: Cannot find > function addEventListener. (httpunit#19) > > Are the "httpunit#" 's known unsupported TODO features? > Are they listed anywhere? -- probably in the httpunit source. > > On my first target page, I have many 19's, so I'd vote for that as a > priority, but I also have: > 19 > 32 > 9 > 838 > 624 > 226 > 1 > > I suppose I am at a dead end regarding my script login task. > > Can anyone recommend a different free offering that may be able to > login via "automation"? > > But I was also considering Google V8 JavaScript Engine > http://code.google.com/p/v8/ "V8 is Google's open source JavaScript > engine." > > The httpunit developers may want to consider using V8 for their > JavaScript support. I may try V8 myself with either CURL or httpunit. > I saw that getDOM method which I believe is the data V8 wants. > > Regards, > Dee > > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop > |
|
From: Dee A. <de...@gm...> - 2011-03-25 18:31:58
|
I'm trying httpunit because I am trying to login via script to a website that I assume is running JavaScript as part of its authentication method and I needed something to run the returned JavaScript which CURL does not run. I got an error: org.mozilla.javascript.EcmaError: TypeError: Cannot find function addEventListener. (httpunit#19) Then noticed "addEventListener" is not listed here http://httpunit.sourceforge.net/doc/javascript-support.html Then I added HttpUnitOptions per http://httpunit.sourceforge.net/doc/faq.html#unsupported and saw many more errors with the first displaying as: failed: org.mozilla.javascript.EcmaError: TypeError: Cannot find function addEventListener. (httpunit#19) Are the "httpunit#" 's known unsupported TODO features? Are they listed anywhere? -- probably in the httpunit source. On my first target page, I have many 19's, so I'd vote for that as a priority, but I also have: 19 32 9 838 624 226 1 I suppose I am at a dead end regarding my script login task. Can anyone recommend a different free offering that may be able to login via "automation"? But I was also considering Google V8 JavaScript Engine http://code.google.com/p/v8/ "V8 is Google's open source JavaScript engine." The httpunit developers may want to consider using V8 for their JavaScript support. I may try V8 myself with either CURL or httpunit. I saw that getDOM method which I believe is the data V8 wants. Regards, Dee |
|
From: Izzy A. <izz...@gm...> - 2011-03-25 18:17:07
|
Maven is nice, but it's good to understand the fundamentals too. ;) > Why did the above fail? Yeah, tilde expansion rules are weird. It's important to note that bash (or your shell of choice) is responsible for performing the tilde expansion, the program (java in this case) always sees the fully expanded (non-relative) paths. Tildes at the beginning of an argument are always expanded (caveats may apply). But tildes following colons are only expanded in a "variable assignment" -- an argument with an equal sign in it. As an example: echo FOO=.:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar vs echo .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar vs echo ~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar:. On Fri, Mar 25, 2011 at 11:45 AM, Dee Ayy <de...@gm...> wrote: >> For that particular example, at a minimum you need: >> java -classpath >> ../Downloads/httpunit-1.7/jars/js-1.6R5.jar:../Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:../Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:../Downloads/httpunit-1.7/lib/httpunit.jar:. >> Example > > I had tried what I thought was the above variation: > java -classpath > .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar > Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > Why did the above fail? > I list the current directory "." to find my Example.class > Then I list httpunit.jar then the reamining jars, yet you listed > httpunit.jar last. Does this order matter? > > Your export worked! Thanks. But I'm still confused. > It seems that "-classpath" does not like relative paths? > MY_JARS now contains absolute paths. When I manually type absolute > paths it worked. > > Thanks for saving me from classpath hell. > > Dee > |
|
From: Russell G. <ru...@go...> - 2011-03-25 17:45:30
|
Hi Narinder, sorry for not responding sooner. The error you are seeing seems to be coming from the jasper servlet, which handles JSP processing. Do you have a full stack trace? ServletUnit should not be doing this kind of path manipulation.
On Jan 13, 2011, at 8:48 AM, Narinder Kumar wrote:
> Hi Wolfgang,
>
> Thanks for your reply. I will try to dig into it myself and get back to you with more information if I am able to find the root cause of the problem.
>
> BTW : Are you the only one supporting httpunit and servlet modules or you get some other collaborators as well from time to time ?
>
> Best Regards
> Narinder
>
> 2011/1/13 Wolfgang Fahl <wf...@bi...>
> Narinder,
>
> thanks for making the mailinglist a bit more active with your e-mail.
> I'd be happy to support you but there are two obstacles:
> - Servlet...something is not the part of httpunit I know well
> - I have other urgent issues on my agenda that hold me up.
>
> You might want to investigate a solution and post it accoring to the FAQs.
>
> Yours
>
> Wolfgang
>
> Am 13.01.11 11:19, schrieb Narinder Kumar:
>>
>> Hi,
>>
>> I was planning to unit test my Servlet through ServletUnit and ran across some problems :
>>
>> As a starting point, we are supposed to create a ServletRunner object. One of the constructors expects File object with web.xml file. I provide the full path of my web.xml file but somehow it ignores the path provided and searches at the top level folder. The code-snippet and error message is below:
>> <code>
>> ServletRunner sr = new ServletRunner(new File("C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml"));
>> ServletUnitClient sc = sr.newClient();
>>
>> WebRequest request = new PostMethodWebRequest("http://localhost/login" );
>> request.setParameter( "userId", "test" );
>> request.setParameter( "password", "csd" );
>>
>> WebResponse response = sc.getResponse(request);
>>
>> String text = response.getText();
>> Assert.assertTrue(text.contains("Welcome to Leave Management System"));
>> </code>
>> com.meterware.httpunit.HttpInternalErrorException: Error on HTTP request: 500 org.apache.jasper.JasperException: java.io.FileNotFoundException: C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml (The system cannot find the path specified) [http://localhost/login]
>> Why does the system keep on looking at the folder structure to be .../WEB-INF/web.xml. Mine is a maven project and I would not like to change the structure of the project to adapt this way. How can I make ServletRunner class to read from a specified folder ?
>> In the Servlet code, I use the following code :
>> String result = null
>> if (someCondition)
>> result = "/welcome.jsp";
>> } else {
>> logger.warn("Password Validation failed");
>> request.setAttribute("failedlogin", new Boolean(true));
>> result = "/index.jsp";
>> }
>> }
>> RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(result);
>> requestDispatcher.forward(request, response);
>>
>> Again ServletUnit expects welcome.jsp to be at root foler, though jsp files are present at .../src/main/webapp/ folder. Again how can ServletUnit be told about the target folder location ?
>>
>> Many thanks in advance.
>>
>> Best Regards
>> Narinder
>>
>> ------------------------------------------------------------------------------
>> Protect Your Site and Customers from Malware Attacks
>> Learn about various malware tactics and how to avoid them. Understand
>> malware threats, the impact they can have on your business, and how you
>> can protect your company and customers by using code signing.
>> http://p.sf.net/sfu/oracle-sfdevnl
>>
>> _______________________________________________
>> Httpunit-develop mailing list
>> Htt...@li...
>> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
> --
>
> BITPlan - smart solutions
> Wolfgang Fahl
> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
> Tel. +49 2154 811-480, Fax +49 2154 811-481
> Web: http://www.bitplan.de
> BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Httpunit-develop mailing list
> Htt...@li...
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl_______________________________________________
> Httpunit-develop mailing list
> Htt...@li...
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>,
and listen to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!
|
|
From: Dee A. <de...@gm...> - 2011-03-25 17:10:03
|
On Fri, Mar 25, 2011 at 12:04 PM, Dee Ayy <de...@gm...> wrote: > Wolfgang, > No rush, but where is your [updated] FAQ? > > Thanks, > Dee > Sorry. I see the email to the list now. |
|
From: Dee A. <de...@gm...> - 2011-03-25 17:04:19
|
Wolfgang, No rush, but where is your [updated] FAQ? Thanks, Dee |
|
From: Wolfgang F. <wf...@bi...> - 2011-03-25 16:24:12
|
This is how I tested a few httpunit revisions. Maven is much simpler in usage than fiddling with classpath just like that. The ant scripts are checked out while doing so and you'll find a build.xml that has automated classpath building in. Anyone volunteering to add a classpath print message to that build.xml? It would help solve the issue of what classpath is necessary when trying to start things from the command line. Also the classpath could be added to the manifest file of an example.jar which could be created in the build.xml I'm to busy for these patches -they are certainly feasible ... root=`pwd` for r in 1020 1030 1040 1050 1060 1061 do cd $root svn checkout -r $r https://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit httpunit$r cd httpunit$r mvn test done Am 25.03.11 16:45, schrieb Dee Ayy: >> For that particular example, at a minimum you need: >> java -classpath >> ../Downloads/httpunit-1.7/jars/js-1.6R5.jar:../Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:../Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:../Downloads/httpunit-1.7/lib/httpunit.jar:. >> Example > I had tried what I thought was the above variation: > java -classpath > .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar > Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > Why did the above fail? > I list the current directory "." to find my Example.class > Then I list httpunit.jar then the reamining jars, yet you listed > httpunit.jar last. Does this order matter? > > Your export worked! Thanks. But I'm still confused. > It seems that "-classpath" does not like relative paths? > MY_JARS now contains absolute paths. When I manually type absolute > paths it worked. > > Thanks for saving me from classpath hell. > > Dee > > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop > -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |
|
From: Dee A. <de...@gm...> - 2011-03-25 15:45:10
|
> For that particular example, at a minimum you need: > java -classpath > ../Downloads/httpunit-1.7/jars/js-1.6R5.jar:../Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:../Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:../Downloads/httpunit-1.7/lib/httpunit.jar:. > Example I had tried what I thought was the above variation: java -classpath .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar Example Exception in thread "main" java.lang.NoClassDefFoundError: com/meterware/httpunit/WebRequest Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest Why did the above fail? I list the current directory "." to find my Example.class Then I list httpunit.jar then the reamining jars, yet you listed httpunit.jar last. Does this order matter? Your export worked! Thanks. But I'm still confused. It seems that "-classpath" does not like relative paths? MY_JARS now contains absolute paths. When I manually type absolute paths it worked. Thanks for saving me from classpath hell. Dee |
|
From: Wolfgang F. <wf...@bi...> - 2011-03-25 07:17:10
|
Dear httpunit developers and users, Please let me know what other questions you'd like to see answered in this FAQ and I'll try to add them together with a decent answer. Please read the parts on Questions #5 and #6 before submitting any proposed changes ... this will speed up things a lot. Currently only about 3-4 out of 10 tracker or mailing list requests follow this procedure. If we get this up to more than 60% it would be a good start so that the response time can improve again. FAQ === 1. Where can I get information on httpunit? 2. Where do i get the most recent version of httpunit 3. Where do I find examples for the use of httpunit? 4. How do I sign up for the developer mailing list? 5. How do I get support for httpunit? 6. How can I suggest modifications to httpunit? 7. How do I find a testcase to start from? 8. What is the development environment for httpunit? 9. What do I do if i have trouble using httpunit with JavaScript? 10. Who are the developers behing httpunit? 11. What is the current version of httpunit? 1. Where can I get information on httpunit? ------------------------------------------- httpunit is an OpenSource Project and it is hosted on SourceForge at https://sourceforge.net/projects/httpunit. There is a project homepage at http://www.httpunit.org/ which contains a limited set of documentation. There is a general FAQ section at http://www.httpunit.org/doc/faq.html 2. Where do i get the most recent version of httpunit ----------------------------------------------------- The most recent version of httpunit can be found in the Subversion repository. The repository is explained at: https://sourceforge.net/scm/?type=svn&group_id=6550 the URL for it is: https://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit/ A nice browser front end for it is: http://httpunit.svn.sourceforge.net/viewvc/httpunit/trunk/httpunit/ 3. Where do I find examples for the use of httpunit? ---------------------------------------------------- a) There is a "cookbook" http://www.httpunit.org/doc/cookbook.html b) There is a tutorial: http://www.httpunit.org/doc/tutorial/index.html c) There are examples delivered with httpunit and accesible via the subversion respository: http://httpunit.svn.sourceforge.net/viewvc/httpunit/trunk/httpunit/examples/ 4. How do I sign up for the developer mailing list? --------------------------------------------------- via the link https://lists.sourceforge.net/lists/listinfo/httpunit-develop 5. How do I get support for httpunit? ------------------------------------- This mailing list and the trackers on https://sourceforge.net/projects/httpunit/support are a good point to start. Don't expect too much - you might want to get active yourself. 6. How can I suggest modifications to httpunit? ----------------------------------------------- httpunit is strictly based on test-first development. If you'd like to get it modified you might want to prove your point by showing what is not working and how you would like it to work. Doing this within the JUnit testsuite of httpunit is the preferred way. And providing the test source code first gives you much better chances of a quick response. If you'd like to supply a minor change that is easy to understand and does not change anything or not much (e.g. adding a comment or changing the layout of a statement or doing an algorithm slightly different) then it might be sufficient to show that the change does not break any of the existing test cases. Don't count on this. A JUnit test case is your better option. Please supply a testcase with the expected result for the feature you are asking for and we'll look into implementing it. For a start you might want to get the trunk version from the subversion repository (see https://sourceforge.net/scm/?type=svn&group_id=6550 and have a look at the source code of some of the more than 800 JUnit based testcases in there. Eclipse workspace patch files are welcome - other formats are also o.k. but just a bit more work. When you are ready you might want to attach the testcase (and if you already have started implementing it also the actual code) to your feature request. If you propose a change make sure that all testcases run so after the change there should be more testcases than before and none of them is broken / does not work any more. This should give you a clue on what a proper testcase for httpunit looks like. The main communication about further details of the development is via the httpunit developer mailinglist. 7. How do I find a testcase to start from? ------------------------------------------ a) To find such tests I usually set a break point at the function that I'd like to test and then run all tests from the HttpUnitSuite. When the debugger halts at the breakpoint you'll see which test(s) called the function. b) Another option is to search the full source code of all tests for keywords that match what your are intending to do c) A third option is to look in the tracker items https://sourceforge.net/tracker/?group_id=6550 and look for a comparable issue. Then use the trackers id e.g. Bug report number to find a test case for it. 8. What is the development environment for httpunit? ---------------------------------------------------- You need a Java compiler and may be an Integrated Development Environment like Eclipse. Currently httpunit is mostly tested on these operating systems: - Windows XP, Windows 7 - Suse Linux 11.3 - The latest Mac OS X (10.6) The test environment is Eclipse Ganymede with a JDK 1.6 compiler set to JDK 1.4 compatiblity mode (this is also what you'll find set up in the Subversion library) People from this mailing list also test with command line Maven environments, NetBeans and what have you got (it would be good to get some examples named here ... feel free to let me know your environment if it is an addition to the above) 9. What do I do if i have trouble using httpunit with JavaScript? ----------------------------------------------------------------- HttpUnit 1.x support of Javascript is limited. There is a new Javascript engine in development but the development is almost stalled due to limited resources. To work around the issue you might want to - try the new scripting engine - switch off javascript - if you get an org.mozilla.javascript.EcmAError ... undefined ... find the missing javascript function, implement it and supply the patch for the community see "6. How can I suggest modifications to httpunit?" 10. Who are the developers behind httpunit? ------------------------------------- Russell is the main developer of httpunit. He made it open source and dozens of people have since then supplied input e.g. in form of patches. Wolfgang has been committer for a few years now - he concentrates on communicating with the developers and gathering patches. 11. What is the current version of httpunit? ------------------------------------ The 1.7 release available for download on Sourceforge is stable but does not have the set of patches since that release. A maintainance release is due since mid 2010 and might show up anytime soon. Thank you for reading these Frequently Asked Questions and Answers. Yours Wolfgang |
|
From: Wolfgang F. <wf...@bi...> - 2011-03-25 07:17:03
|
Dear Dee, you might want to go from the Subversion content which has Maven support. I'll post the FAQ in a minute and you'll find links in there pointing in the right direction. Yours Wolfgang Am 24.03.11 23:31, schrieb Dee Ayy: > I am under the impression that httpunit can run stand-alone. What > minimal steps do I need to take to build and run Example.java from my > own path, so that I know I'm not corrupting the httpunit project > files? > > This is what I've done, but am getting java.lang.NoClassDefFoundError > > 1) Download http://prdownloads.sourceforge.net/httpunit/httpunit-1.7.zip?download > (link on http://httpunit.sourceforge.net/ page "Download 1.7") > 2) Expand httpunit-1.7.zip into its own folder ~/Downloads/httpunit-1.7 > 3) Open shell and cd to ~/Downloads/httpunit-1.7 > 4) Run ant jar > 5) Run ant run-example > Assumed httpunit is good to go. Let's start custom "Hello World" > 6) Copy httpunit-1.7/examples/Example.java to ~/custom/Example.java > 7) cd ~/custom > 8) javac -version > javac 1.6.0_24 > 9) javac -classpath ~/Downloads/httpunit-1.7/lib/httpunit.jar Example.java > 10) ls > Example.class Example.java > 11) java -version > java version "1.6.0_24" > Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) > Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) > 12) java -classpath . Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > ... > Why did it NOT throw an exception at WebConversation? WebRequest is > later in the Example.java source file. Surely it found the classes? > > 13) java -classpath .:~/Downloads/httpunit-1.7/lib/httpunit.jar Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > 14) java -classpath .:~/Downloads/httpunit-1.7/build/classes/ Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > 15) java -classpath > .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/build/classes/ > Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > What steps am I missing? Please keep it minimal. No Tomcat; No more > ant, etc. Can we just use javac and java now that ant run-example > worked? > > I've been trying to avoid using an IDE because I will ultimately run > this on a low power machine. But maybe I can put everything in 1 jar > using Eclipse and eventually do "java -jar Custom.jar" on the low > power machine. Unless I am really close above. > > Thanks. > > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop > -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |
|
From: Izzy A. <izz...@gm...> - 2011-03-25 01:38:12
|
> Why did it NOT throw an exception at WebConversation? WebRequest is > later in the Example.java source file. Surely it found the classes? No, the order in the source doe isn't necessarily the order the JVM uses to resolve classes. The httpunit.jar file doesn't include all the required dependencies. You need some more jars in your classpath (from ~/Downloads/httunit-1.7/jars) For that particular example, at a minimum you need: java -classpath ../Downloads/httpunit-1.7/jars/js-1.6R5.jar:../Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:../Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:../Downloads/httpunit-1.7/lib/httpunit.jar:. Example But for convenience, If I were doing that on the command line, I'd (personally, probably) do something like: export MY_JARS=`find ~/Downloads/httpunit-1.7 -name "*.jar" | tr '\n' ':'` java -classpath $MY_JARS:. Example On Thu, Mar 24, 2011 at 6:31 PM, Dee Ayy <de...@gm...> wrote: > I am under the impression that httpunit can run stand-alone. What > minimal steps do I need to take to build and run Example.java from my > own path, so that I know I'm not corrupting the httpunit project > files? > > This is what I've done, but am getting java.lang.NoClassDefFoundError > > 1) Download http://prdownloads.sourceforge.net/httpunit/httpunit-1.7.zip?download > (link on http://httpunit.sourceforge.net/ page "Download 1.7") > 2) Expand httpunit-1.7.zip into its own folder ~/Downloads/httpunit-1.7 > 3) Open shell and cd to ~/Downloads/httpunit-1.7 > 4) Run ant jar > 5) Run ant run-example > Assumed httpunit is good to go. Let's start custom "Hello World" > 6) Copy httpunit-1.7/examples/Example.java to ~/custom/Example.java > 7) cd ~/custom > 8) javac -version > javac 1.6.0_24 > 9) javac -classpath ~/Downloads/httpunit-1.7/lib/httpunit.jar Example.java > 10) ls > Example.class Example.java > 11) java -version > java version "1.6.0_24" > Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) > Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) > 12) java -classpath . Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > ... > Why did it NOT throw an exception at WebConversation? WebRequest is > later in the Example.java source file. Surely it found the classes? > > 13) java -classpath .:~/Downloads/httpunit-1.7/lib/httpunit.jar Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > 14) java -classpath .:~/Downloads/httpunit-1.7/build/classes/ Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > 15) java -classpath > .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/build/classes/ > Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest > > What steps am I missing? Please keep it minimal. No Tomcat; No more > ant, etc. Can we just use javac and java now that ant run-example > worked? > > I've been trying to avoid using an IDE because I will ultimately run > this on a low power machine. But maybe I can put everything in 1 jar > using Eclipse and eventually do "java -jar Custom.jar" on the low > power machine. Unless I am really close above. > > Thanks. > > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop > |
|
From: Dee A. <de...@gm...> - 2011-03-24 22:31:37
|
I am under the impression that httpunit can run stand-alone. What minimal steps do I need to take to build and run Example.java from my own path, so that I know I'm not corrupting the httpunit project files? This is what I've done, but am getting java.lang.NoClassDefFoundError 1) Download http://prdownloads.sourceforge.net/httpunit/httpunit-1.7.zip?download (link on http://httpunit.sourceforge.net/ page "Download 1.7") 2) Expand httpunit-1.7.zip into its own folder ~/Downloads/httpunit-1.7 3) Open shell and cd to ~/Downloads/httpunit-1.7 4) Run ant jar 5) Run ant run-example Assumed httpunit is good to go. Let's start custom "Hello World" 6) Copy httpunit-1.7/examples/Example.java to ~/custom/Example.java 7) cd ~/custom 8) javac -version javac 1.6.0_24 9) javac -classpath ~/Downloads/httpunit-1.7/lib/httpunit.jar Example.java 10) ls Example.class Example.java 11) java -version java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) 12) java -classpath . Example Exception in thread "main" java.lang.NoClassDefFoundError: com/meterware/httpunit/WebRequest Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest ... Why did it NOT throw an exception at WebConversation? WebRequest is later in the Example.java source file. Surely it found the classes? 13) java -classpath .:~/Downloads/httpunit-1.7/lib/httpunit.jar Example Exception in thread "main" java.lang.NoClassDefFoundError: com/meterware/httpunit/WebRequest Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest 14) java -classpath .:~/Downloads/httpunit-1.7/build/classes/ Example Exception in thread "main" java.lang.NoClassDefFoundError: com/meterware/httpunit/WebRequest Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest 15) java -classpath .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/build/classes/ Example Exception in thread "main" java.lang.NoClassDefFoundError: com/meterware/httpunit/WebRequest Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest What steps am I missing? Please keep it minimal. No Tomcat; No more ant, etc. Can we just use javac and java now that ant run-example worked? I've been trying to avoid using an IDE because I will ultimately run this on a low power machine. But maybe I can put everything in 1 jar using Eclipse and eventually do "java -jar Custom.jar" on the low power machine. Unless I am really close above. Thanks. |
|
From: SHUBHAM G. <shu...@cr...> - 2011-02-07 14:50:31
|
/*
Hi,
I need help regarding the following code that I have tried to use. I'm trying to
login into an application automatically by running this code using httpUnit API.
I have a login page where I'm required to input username & password & also have
a submit button. I'm successfully able to do this but when the form is submitted
& when my I.E. 7 / Chrome 8 browser opens up, it doesn't redirect to the main
page after logging-in. Instead, it gives an error "your session has been
expired,please login again" which is an application generated error. I tried to
debug with various statements & came to know that I'm being successfully
authenticated & reaching the right page when i apply getText() methods but the
session is getting expired. Also when i check the header information, it is
displaying same JSESSION ID every time for the cookie . I'm not able to
understand how to rectify this problem.
The code is working fine. You need to use the following jar files: httpunit-
1.6.jar, Tidy.jar, js.jar & xmlParserAPIs.jar. And also u'll have to give a
login page url with the form name along with the username & password values
(their form names also) to set their values in the form.
I request you all to help me out with the same & give me a solution since I need
to get through it quickly.
*/
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.HttpUnitOptions;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebForm;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.ClientProperties;
import com.meterware.httpunit.cookies.CookieListener;
import com.meterware.httpunit.cookies.CookieProperties;
import com.meterware.httpunit.HttpInternalErrorException;
public class Test2 {
public static void main(String[] args) {
try {
// Here's the browser
WebConversation wc = new WebConversation();
CookieProperties.setDomainMatchingStrict(false);
CookieProperties.setPathMatchingStrict(false);
// Don't throw exceptions when JavaScript errors occur
HttpUnitOptions.setExceptionsThrownOnScriptError(false);
HttpUnitOptions.setLoggingHttpHeaders(true);
ClientProperties cltprops = wc.getClientProperties();
//cltprops.setUserAgent("Mozilla/5.0 (X11; U; Linux
i686; en-US; rv:1.7.3) Gecko/HTTPUnit");
cltprops.setAcceptGzip(false);
cltprops.setAutoRedirect(true);
cltprops.setAcceptCookies(true);
cltprops.setAutoRefresh( true );
CookieProperties.addCookieListener(new CookieListener()
{
public void cookieRejected(String s, int i,
String s1) {
System.out
.println("CookieProperties.isDomainMatchingStrict() = "
+
CookieProperties.isDomainMatchingStrict());
System.out
.println("CookieProperties.isPathMatchingStrict() = "
+
CookieProperties.isPathMatchingStrict());
System.out.println("s = " + s);
System.out.println("s1 = " + s1);
System.out.println("Reason: " + i);
}
});
//here input your own login page address
WebRequest req = new GetMethodWebRequest(
"http://yourloginpage.com");
req.setHeaderField("ORA_WX_SESSION", "10.1.0.34:47873-
2#3");
req.setHeaderField("Keep-Alive","300");
req.setHeaderField("Connection","keep-alive");
req.setHeaderField("JSESSIONID",
"0a01002230d7760c3064f5d54d71b35e84bd606926fc.e3aOaNuPbhiQe3uMc3mPbNaRbO0");
req.setParameter("formar_SUBMIT","1");
req.setParameter("jsf_sequence","5");
req.setParameter("formar:_link_hidden_","");
req.setParameter("pCodigo","02011000");
req.setParameter("formar:_idcl","formar:tree:0:0:0:parter2");
// Fetch a page
WebResponse resp = wc.getResponse(req);
// here input the name of the login form
WebForm form = resp.getFormWithName("LoginForm");
System.out.println(wc.getCookieValue("JSESSIONID"));
String[] cookies = wc.getCookieNames();
for (int i = 0; i < cookies.length; i++) {
String cooky = cookies[i];
System.out.println("");
System.out.println(cooky + " = " +
wc.getCookieValue(cooky));
wc.putCookie(cooky, wc.getCookieValue(cooky));
}
//wc.set_connectTimeout();
//here input the username & password parameters with
correct parameter names
form.setParameter("username", "admin");
form.setParameter("password", "admin");
System.out.println(form.getParameterValue("username"));
form.submit();
for (int i = 0; i < cookies.length; i++) {
String cooky = cookies[i];
System.out.println(cooky + " = " +
wc.getCookieValue(cooky));
wc.putCookie(cooky, wc.getCookieValue(cooky));
}
resp = wc.getCurrentPage();
System.out.println(resp.getResponseMessage() + " " +
resp.getURL() + " " + resp.getContentType());
//System.out.println(resp.getText());
//WebForm [] forms=resp.getForms();
URL url=resp.getURL();
/*
System.out.println(CookieListener.ACCEPTED);
System.out.println(wc.getHeaderField("JSESSIONID"));
System.out.println(wc.getCookieValue("cooky"));
*/
// System.out.println(wc.getHeaderFields(url));
for (int i = 0; i < cookies.length; i++) {
String cooky = cookies[i];
System.out.println(cooky + " = " +
wc.getCookieValue(cooky));
wc.putCookie(cooky, wc.getCookieValue(cooky));
}
openURL(resp.getURL());
//System.out.println(resp.getText());
}
catch(HttpInternalErrorException ne)
{
System.out.println(ne.getMessage());
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void openURL(URL url) throws ClassNotFoundException,
NoSuchMethodException, IllegalAccessException,
InvocationTargetException, IOException,
InterruptedException {
String osName = System.getProperty("os.name");
if (osName.startsWith("Mac OS")) {
Class fileMgr =
Class.forName("com.apple.eio.FileManager");
Method openURL = fileMgr.getDeclaredMethod("openURL",
new Class[] { String.class });
openURL.invoke(null, new Object[] { url.toString() });
} else if (osName.startsWith("Windows")) {
String cmdLine = "rundll32 url.dll,FileProtocolHandler "
+ url.toString();
Process exec = Runtime.getRuntime().exec(cmdLine);
exec.waitFor();
} else { // assume Unix or Linux
String[] browsers = { "firefox", "opera", "konqueror",
"epiphany",
"mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser
== null; count++) {
if (Runtime.getRuntime().exec(
new String[] { "which",
browsers[count] }).waitFor() == 0) {
browser = browsers[count];
}
}
if (browser == null) {
throw new IllegalStateException("Could not find
web browser");
} else {
Runtime.getRuntime().exec(
new String[] { browser,
url.toString() });
}
}
}
}
//Thanks.
|
|
From: Laxman K. <lax...@ho...> - 2011-01-16 12:41:04
|
Hi, This is Kishan from SingaporeI would like to know about httpunit.Could you please tell me will it work for testing any type of web sites (ie. banking / finance / commerial / entertainment / gov. / public services and moreover with https protocol ) also ? Because I tried to connect to my gmail account & my internet banking for my account., its not loading home package even since Some scriptlet engine error coming while loading home pages itself. But through htmlunit I'm unable to access any of web site with having any issue. Can you please tel me what could be the issue I just downloaded httpunit jar & other dependencies jars also from sourceforge.net link only. But its unable to access all web sites whatever we want to connect & access for testing. Please help me out what to do to access all require web sites by using this httpunit ..! I'm eagerly waiting for your reply soon. Thank you & regards, Kishan. Singapore. |
|
From: Laxman K. <lax...@ho...> - 2011-01-16 12:24:43
|
Hi Narindar Kumar, This is Kishan from hyd,india. I would like to know about httpunit. Could you please tell me will it work for testing any type of web sites (ie. banking / finance / commerial / entertainment / gov. / public services and moreover with https protocol ) also ? Because I tried to connect to my gmail account & my internet banking for my account., its not loading home package even since Some scriptlet engine error coming while loading home pages itself. But through htmlunit I'm unable to access any of web site with having any issue. Can you please tel me what could be the issue I just downloaded httpunit jar & other dependencies jars also from sourceforge.net link only. But its unable to access all web sites whatever we want to connect & access for testing. Please help me out what to do to access all require web sites by using this httpunit ..! I'm eagerly waiting for your reply soon. Thank you & regards, Kishan. Hyd,India. Date: Thu, 13 Jan 2011 19:18:37 +0530 From: nk...@in... To: htt...@li... Subject: Re: [Httpunit-develop] Problems in Starting up with ServletUnit Hi Wolfgang, Thanks for your reply. I will try to dig into it myself and get back to you with more information if I am able to find the root cause of the problem. BTW : Are you the only one supporting httpunit and servlet modules or you get some other collaborators as well from time to time ? Best RegardsNarinder 2011/1/13 Wolfgang Fahl <wf...@bi...> Narinder, thanks for making the mailinglist a bit more active with your e-mail. I'd be happy to support you but there are two obstacles: - Servlet...something is not the part of httpunit I know well - I have other urgent issues on my agenda that hold me up. You might want to investigate a solution and post it accoring to the FAQs. Yours Wolfgang Am 13.01.11 11:19, schrieb Narinder Kumar: Hi, I was planning to unit test my Servlet through ServletUnit and ran across some problems : As a starting point, we are supposed to create a ServletRunner object. One of the constructors expects File object with web.xml file. I provide the full path of my web.xml file but somehow it ignores the path provided and searches at the top level folder. The code-snippet and error message is below: <code> ServletRunner sr = new ServletRunner(new File("C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml")); ServletUnitClient sc = sr.newClient(); WebRequest request = new PostMethodWebRequest("http://localhost/login" ); request.setParameter( "userId", "test" ); request.setParameter( "password", "csd" ); WebResponse response = sc.getResponse(request); String text = response.getText(); Assert.assertTrue(text.contains("Welcome to Leave Management System")); </code> com.meterware.httpunit.HttpInternalErrorException: Error on HTTP request: 500 org.apache.jasper.JasperException: java.io.FileNotFoundException: C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml (The system cannot find the path specified) [http://localhost/login] Why does the system keep on looking at the folder structure to be .../WEB-INF/web.xml. Mine is a maven project and I would not like to change the structure of the project to adapt this way. How can I make ServletRunner class to read from a specified folder ? In the Servlet code, I use the following code : String result = null if (someCondition) result = "/welcome.jsp"; } else { logger.warn("Password Validation failed"); request.setAttribute("failedlogin", new Boolean(true)); result = "/index.jsp"; } } RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(result); requestDispatcher.forward(request, response); Again ServletUnit expects welcome.jsp to be at root foler, though jsp files are present at .../src/main/webapp/ folder. Again how can ServletUnit be told about the target folder location ? Many thanks in advance. Best Regards Narinder ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Httpunit-develop mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/httpunit-develop -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Httpunit-develop mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/httpunit-develop ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Httpunit-develop mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/httpunit-develop |
|
From: Izzy A. <izz...@gm...> - 2011-01-14 14:43:53
|
Wolfgang doesn't get nearly as much help as he should around here.
But, try using the ServletRunner constructor that takes a contextPath
parameter (in addition to the web.xml file) -- just set it to null or
the empty string if you don't actually want a context path.
Wolfgang: I think this is a bug. That version of constructor sets the
_contextDir field in WebApplication -- which helps the WebApplication
class resolve the jsp file reference relative to the location of the
web.xml file, but the other ServletRunner constructors don't set that
field, which makes WebApplication resolve the jsp files relative to
the current working directory.
- Izzy
2011/1/13 Narinder Kumar <nk...@in...>:
> Hi Wolfgang,
> Thanks for your reply. I will try to dig into it myself and get back to you
> with more information if I am able to find the root cause of the problem.
> BTW : Are you the only one supporting httpunit and servlet modules or you
> get some other collaborators as well from time to time ?
> Best Regards
> Narinder
>
> 2011/1/13 Wolfgang Fahl <wf...@bi...>
>>
>> Narinder,
>>
>> thanks for making the mailinglist a bit more active with your e-mail.
>> I'd be happy to support you but there are two obstacles:
>> - Servlet...something is not the part of httpunit I know well
>> - I have other urgent issues on my agenda that hold me up.
>>
>> You might want to investigate a solution and post it accoring to the FAQs.
>>
>> Yours
>>
>> Wolfgang
>>
>> Am 13.01.11 11:19, schrieb Narinder Kumar:
>>
>> Hi,
>> I was planning to unit test my Servlet through ServletUnit and ran across
>> some problems :
>>
>> As a starting point, we are supposed to create a ServletRunner object. One
>> of the constructors expects File object with web.xml file. I provide the
>> full path of my web.xml file but somehow it ignores the path provided and
>> searches at the top level folder. The code-snippet and error message is
>> below:
>>
>> <code>
>> ServletRunner sr = new ServletRunner(new
>> File("C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml"));
>> ServletUnitClient sc = sr.newClient();
>> WebRequest request = new
>> PostMethodWebRequest("http://localhost/login" );
>> request.setParameter( "userId", "test" );
>> request.setParameter( "password", "csd" );
>> WebResponse response = sc.getResponse(request);
>>
>> String text = response.getText();
>> Assert.assertTrue(text.contains("Welcome to Leave Management System"));
>> </code>
>> com.meterware.httpunit.HttpInternalErrorException: Error on HTTP request:
>> 500 org.apache.jasper.JasperException: java.io.FileNotFoundException:
>> C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml (The system cannot find
>> the path specified) [http://localhost/login]
>>
>> Why does the system keep on looking at the folder structure to be
>> .../WEB-INF/web.xml. Mine is a maven project and I would not like to change
>> the structure of the project to adapt this way. How can I make ServletRunner
>> class to read from a specified folder ?
>>
>> In the Servlet code, I use the following code :
>>
>> String result = null
>> if (someCondition)
>> result = "/welcome.jsp";
>> } else {
>> logger.warn("Password Validation failed");
>> request.setAttribute("failedlogin", new Boolean(true));
>> result = "/index.jsp";
>> }
>> }
>> RequestDispatcher requestDispatcher =
>> getServletContext().getRequestDispatcher(result);
>> requestDispatcher.forward(request, response);
>>
>> Again ServletUnit expects welcome.jsp to be at root foler, though jsp
>> files are present at .../src/main/webapp/ folder. Again how can ServletUnit
>> be told about the target folder location ?
>>
>> Many thanks in advance.
>> Best Regards
>> Narinder
>>
>>
>> ------------------------------------------------------------------------------
>> Protect Your Site and Customers from Malware Attacks
>> Learn about various malware tactics and how to avoid them. Understand
>> malware threats, the impact they can have on your business, and how you
>> can protect your company and customers by using code signing.
>> http://p.sf.net/sfu/oracle-sfdevnl
>>
>> _______________________________________________
>> Httpunit-develop mailing list
>> Htt...@li...
>> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>>
>> --
>>
>> BITPlan - smart solutions
>> Wolfgang Fahl
>> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
>> Tel. +49 2154 811-480, Fax +49 2154 811-481
>> Web: http://www.bitplan.de
>> BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548,
>> Geschäftsführer: Wolfgang Fahl
>>
>>
>> ------------------------------------------------------------------------------
>> Protect Your Site and Customers from Malware Attacks
>> Learn about various malware tactics and how to avoid them. Understand
>> malware threats, the impact they can have on your business, and how you
>> can protect your company and customers by using code signing.
>> http://p.sf.net/sfu/oracle-sfdevnl
>> _______________________________________________
>> Httpunit-develop mailing list
>> Htt...@li...
>> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>>
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Httpunit-develop mailing list
> Htt...@li...
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
>
|
|
From: Narinder K. <nk...@in...> - 2011-01-13 14:03:06
|
Hi Wolfgang,
Thanks for your reply. I will try to dig into it myself and get back to you
with more information if I am able to find the root cause of the problem.
BTW : Are you the only one supporting httpunit and servlet modules or you
get some other collaborators as well from time to time ?
Best Regards
Narinder
2011/1/13 Wolfgang Fahl <wf...@bi...>
> Narinder,
>
> thanks for making the mailinglist a bit more active with your e-mail.
> I'd be happy to support you but there are two obstacles:
> - Servlet...something is not the part of httpunit I know well
> - I have other urgent issues on my agenda that hold me up.
>
> You might want to investigate a solution and post it accoring to the FAQs.
>
> Yours
>
> Wolfgang
>
> Am 13.01.11 11:19, schrieb Narinder Kumar:
>
> Hi,
>
> I was planning to unit test my Servlet through ServletUnit and ran across
> some problems :
>
>
> - As a starting point, we are supposed to create a ServletRunner
> object. One of the constructors expects File object with web.xml file. I
> provide the full path of my web.xml file but somehow it ignores the path
> provided and searches at the top level folder. The code-snippet and error
> message is below:
>
> <code>
> ServletRunner sr = new ServletRunner(new File("*
> C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml*"));
> ServletUnitClient sc = sr.newClient();
>
> WebRequest request = new PostMethodWebRequest("
> http://localhost/login" );
> request.setParameter( "userId", "test" );
> request.setParameter( "password", "csd" );
>
> WebResponse response = sc.getResponse(request);
>
> String text = response.getText();
> Assert.assertTrue(text.contains("Welcome to Leave Management
> System"));
> </code>
> com.meterware.httpunit.HttpInternalErrorException: Error on HTTP request:
> 500 org.apache.jasper.JasperException: java.io.FileNotFoundException: *
> C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml* (The system cannot
> find the path specified) [http://localhost/login]
>
>
>
> - Why does the system keep on looking at the folder structure to be
> .../WEB-INF/web.xml. Mine is a maven project and I would not like to change
> the structure of the project to adapt this way. How can I make ServletRunner
> class to read from a specified folder ?
>
>
> - In the Servlet code, I use the following code :
>
> String result = null
> if (someCondition)
> result = "/welcome.jsp";
> } else {
> logger.warn("Password Validation failed");
> request.setAttribute("failedlogin", new Boolean(true));
> result = "/index.jsp";
> }
> }
> RequestDispatcher requestDispatcher =
> getServletContext().getRequestDispatcher(result);
> requestDispatcher.forward(request, response);
>
> Again ServletUnit expects welcome.jsp to be at root foler, though jsp
> files are present at .../src/main/webapp/ folder. Again how can ServletUnit
> be told about the target folder location ?
>
> Many thanks in advance.
>
> Best Regards
> Narinder
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.http://p.sf.net/sfu/oracle-sfdevnl
>
>
> _______________________________________________
> Httpunit-develop mailing lis...@li...://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
>
> --
>
> BITPlan - smart solutions
> Wolfgang Fahl
> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
> Tel. +49 2154 811-480, Fax +49 2154 811-481
> Web: http://www.bitplan.de
> BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl
>
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Httpunit-develop mailing list
> Htt...@li...
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
>
|
|
From: Wolfgang F. <wf...@bi...> - 2011-01-13 13:25:09
|
Narinder,
thanks for making the mailinglist a bit more active with your e-mail.
I'd be happy to support you but there are two obstacles:
- Servlet...something is not the part of httpunit I know well
- I have other urgent issues on my agenda that hold me up.
You might want to investigate a solution and post it accoring to the FAQs.
Yours
Wolfgang
Am 13.01.11 11:19, schrieb Narinder Kumar:
> Hi,
>
> I was planning to unit test my Servlet through ServletUnit and ran
> across some problems :
>
> * As a starting point, we are supposed to create a ServletRunner
> object. One of the constructors expects File object with web.xml
> file. I provide the full path of my web.xml file but somehow it
> ignores the path provided and searches at the top level folder.
> The code-snippet and error message is below:
>
> <code>
> ServletRunner sr = new ServletRunner(new
> File("*C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml*"));
> ServletUnitClient sc = sr.newClient();
>
> WebRequest request = new
> PostMethodWebRequest("http://localhost/login" );
> request.setParameter( "userId", "test" );
> request.setParameter( "password", "csd" );
>
> WebResponse response = sc.getResponse(request);
> String text = response.getText();
> Assert.assertTrue(text.contains("Welcome to Leave Management System"));
> </code>
> com.meterware.httpunit.HttpInternalErrorException: Error on HTTP
> request: 500 org.apache.jasper.JasperException:
> java.io.FileNotFoundException:
> *C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml* (The system
> cannot find the path specified) [http://localhost/login]
>
> * Why does the system keep on looking at the folder structure to
> be .../WEB-INF/web.xml. Mine is a maven project and I would not
> like to change the structure of the project to adapt this way.
> How can I make ServletRunner class to read from a specified folder ?
>
> * In the Servlet code, I use the following code :
>
> String result = null
> if (someCondition)
> result = "/welcome.jsp";
> } else {
> logger.warn("Password Validation failed");
> request.setAttribute("failedlogin", new Boolean(true));
> result = "/index.jsp";
> }
> }
> RequestDispatcher requestDispatcher =
> getServletContext().getRequestDispatcher(result);
> requestDispatcher.forward(request, response);
>
> Again ServletUnit expects welcome.jsp to be at root foler, though
> jsp files are present at .../src/main/webapp/ folder. Again how
> can ServletUnit be told about the target folder location ?
>
> Many thanks in advance.
>
> Best Regards
> Narinder
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
>
>
> _______________________________________________
> Httpunit-develop mailing list
> Htt...@li...
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
--
BITPlan - smart solutions
Wolfgang Fahl
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web: http://www.bitplan.de
BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl
|
|
From: Narinder K. <nk...@in...> - 2011-01-13 10:19:16
|
Hi,
I was planning to unit test my Servlet through ServletUnit and ran across
some problems :
- As a starting point, we are supposed to create a ServletRunner object.
One of the constructors expects File object with web.xml file. I provide the
full path of my web.xml file but somehow it ignores the path provided and
searches at the top level folder. The code-snippet and error message is
below:
<code>
ServletRunner sr = new ServletRunner(new File("*
C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml*"));
ServletUnitClient sc = sr.newClient();
WebRequest request = new PostMethodWebRequest("http://localhost/login"
);
request.setParameter( "userId", "test" );
request.setParameter( "password", "csd" );
WebResponse response = sc.getResponse(request);
String text = response.getText();
Assert.assertTrue(text.contains("Welcome to Leave Management System"));
</code>
com.meterware.httpunit.HttpInternalErrorException: Error on HTTP request:
500 org.apache.jasper.JasperException: java.io.FileNotFoundException: *
C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml* (The system cannot find
the path specified) [http://localhost/login]
- Why does the system keep on looking at the folder structure to be
.../WEB-INF/web.xml. Mine is a maven project and I would not like to change
the structure of the project to adapt this way. How can I make ServletRunner
class to read from a specified folder ?
- In the Servlet code, I use the following code :
String result = null
if (someCondition)
result = "/welcome.jsp";
} else {
logger.warn("Password Validation failed");
request.setAttribute("failedlogin", new Boolean(true));
result = "/index.jsp";
}
}
RequestDispatcher requestDispatcher =
getServletContext().getRequestDispatcher(result);
requestDispatcher.forward(request, response);
Again ServletUnit expects welcome.jsp to be at root foler, though jsp files
are present at .../src/main/webapp/ folder. Again how can ServletUnit be
told about the target folder location ?
Many thanks in advance.
Best Regards
Narinder
|
|
From: Wolfgang F. <wf...@bi...> - 2011-01-11 15:34:06
|
Dear httpunit developers, http://httpunit.svn.sourceforge.net/viewvc/httpunit/trunk/httpunit/examples/ Now has a multidownload example. The Swing GUI handling in this example is incorrect. After some 15 years working with Java I still don't get how to get the SwingWorker and thread handling right .. Sigh ... Hopefully someone more knowledgeable will send me a patch and I can then get enlightened on how it should work. I'm looking forward to your feedback. Yours Wolfgang -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |
|
From: Wolfgang F. <wf...@bi...> - 2011-01-11 14:58:47
|
Dear httpunit developers, the examples in http://httpunit.svn.sourceforge.net/viewvc/httpunit/trunk/httpunit/examples/ have been updated by me to mostly work again. I have also added a YouTubeVisitor example. I was not sucessful in creating a full downloader yet and due to legal reasons I do not intend to do so. I'm going to modify the example as "MultiDownload" so that it can automate the download of regular files e.g. software packages and show how this works. Please stay tuned. I'm looking forward to your feedback. Yours Wolfgang -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |
|
From: Amit O. <oam...@ya...> - 2010-11-20 09:13:11
|
<HTML>
<HEAD>
<TITLE> Search Content in Logs </TITLE>
<script language="javascript">
function makeVisible(mode)
{
if(mode == "interactive")
{
document.getElementById("tbox").style.visibility = "visible";
document.getElementById("tarea").style.visibility = "hidden";
}
else
{
document.getElementById("tarea").style.visibility = "visible";
document.getElementById("tbox").style.visibility = "hidden";
}
}
function load()
{
document.getElementById("IMode").checked= true;
document.getElementById("tbox").style.visibility = "visible";
var d = new Date();
var endDate = d.getDate();
var endMonth = d.getMonth() + 1;
var endYear = d.getYear();
var startDate,startMonth,startYear;
if( endDate == 1 )
{
switch(endMonth-1)
{
case 1: startYear = endYear; startMonth = 1; days = 31; break;
case 2: startYear = endYear; startMonth = 2;
if(endYear%4 == 0)
{
days = 29;break;
}
else
{
days = 28; break;
}
case 3: startYear = endYear; startMonth = 3; days = 31; break;
case 4: startYear = endYear; startMonth = 4; days = 30; break;
case 5: startYear = endYear; startMonth = 5; days = 31; break;
case 6: startYear = endYear; startMonth = 6; days = 30; break;
case 7: startYear = endYear; startMonth = 7; days = 31; break;
case 8: startYear = endYear; startMonth = 8; days = 31; break;
case 9: startYear = endYear; startMonth = 9; days = 30; break;
case 10: startYear = endYear; startMonth = 10; days = 31; break;
case 11: startYear = endYear; startMonth = 11; days = 30; break;
case 0: startYear = endYear-1; startMonth = 12; days = 31; break;
}
startDate = (days + endDate)- 1;
}
else
{
startDate = endDate-1;
startMonth = endMonth;
startYear = endYear;
}
document.getElementById("txtStartDate").value = startDate + "/" + startMonth + "/" + startYear;
document.getElementById("txtEndDate").value = endDate + "/" + endMonth + "/" + endYear;
document.getElementById("tbox").focus();
}
function SelectDate(dateField)
{
document.getElementById("hideDate").value = dateField;
D = document.getElementById(dateField).value;
if(D){
D = D.split('/');
}else{
Dat = new Date();
D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
}
win = window.open("date-picker.html","win","status=no,scrollbars=no,toolbar=no,menubar=no,height=200,width=180,left=600,top=425");
if (parseInt(navigator.appVersion) == 2 && navigator.appName == "Netscape")
win = window.open("date-picker.html","win","status=yes,height=325,width=250");
}
function SetDate(Day, Month, Year)
{
document.getElementById(document.getElementById("hideDate").value).value = Day + '/' + Month + '/' + Year;
}
function submitForm()
{
var Submitt = "true";
var tBoxValue = document.getElementById("tbox").value;
var tAreaValue = document.getElementById("tarea").value;
if(document.getElementById("tbox").style.visibility == "visible")
{
if( !(tBoxValue == "") )
{
document.getElementById("searchContent").value = document.getElementById("tbox").value;
}
else
{
alert("Enter the Search Content in the TextBox");
Submitt = "false";
document.getElementById("tbox").focus();
}
}
else if( document.getElementById("tarea").style.visibility == "visible")
{
if ( !(tAreaValue == "") )
{
document.getElementById("searchContent").value = document.getElementById("tarea").value;
}
else
{
alert("Enter the Search Content in the TextArea");
Submitt = "false";
document.getElementById("tarea").focus();
}
}
auditLog = document.getElementById("audit").checked;
errorLog = document.getElementById("error").checked;
debugLog = document.getElementById("debug").checked;
if(auditLog == false && errorLog == false && debugLog == false)
{
alert("Please Select atleast One type of LOG");
Submitt = "false";
}
else
{
document.getElementById("searchInAuditLog").value = auditLog;
document.getElementById("searchInErrorLog").value = errorLog;
document.getElementById("searchInDebugLog").value = debugLog;
}
startDate = document.getElementById("txtStartDate").value;
endDate = document.getElementById("txtEndDate").value;
if(GetDate(startDate) > GetDate(endDate))
{
alert("StartDate shoudn't be greater than the EndDate");
Submitt = "false";
}
/* if( document.getElementById("txtStartDate").value == "" || document.getElementById("txtEndDate").value )
{
alert("Please Check the StartDate and EndDate values");
Submitt = "false";
}
*/
document.getElementById("searchInZipFile").value = document.getElementById("srchInZipFile").checked;
if(Submitt == "true")
{
document.searchForm.action = "mtracker.do";
document.searchForm.submit();
}
}
function GetDate(strDate)
{
var arrDate;
var rtnDate;
arrDate=strDate.split("/");
rtnDate=new Date(arrDate[2],arrDate[1]-1,arrDate[0],0,0,0);
return rtnDate;
}
</script>
</HEAD>
<body background="./images/background.jpg" onLoad="load()" text="#3300CC">
<font face="Arial" color="#000000" size="2">
<center>
<table bordercolor="#0066CC" cellspacing="2" cellpadding="3" width="100%" border="1">
<tr valign="top">
<td>
<p align="center"><strong><font size="6"><font face="Trebuchet MS"><font color="#0000a0">SEARCH PAGE </font></font></font></strong></p></td></tr></table></div></font><br>
<div align="right"><a href="mtracker.do?pageId=searchPage&actionId=logout" target="_top"><font size="3"><B>Logout</B></font>
</a></p></div>
<form name="searchForm" >
<input type=hidden name="pageId" value="searchPage">
<input type=hidden id="actionId" name="actionId" value="search">
Input Mode: <input type=radio name="inputmode" id="IMode" value="single" onClick=makeVisible("interactive") checked="true" >Single Key Search <input type=radio name="inputmode" id="BMode" value="batch" onClick=makeVisible("batch")>Multiple Key Search <br/><br/>
<B> Enter the Search Content Below<br>
<Input type="text" id="tbox" size=40 name="tbox" Style="visibility:visible"><br>
<textarea id="tarea" rows=10 cols=50 name="tarea" Style="visibility:hidden"></textarea><br/><br/>
<pre>
<b>Choose Log Types to Search in
<input type="checkbox" name="audit" value="audit" id="audit" checked> AUDIT LOGS</input>
<input type="checkbox" name="error" value="error" id="error"> ERROR LOGS</input>
</pre>
<pre><input type='checkbox' name='debug' value='debug' id='debug' Style="visibility:hidden"/></pre>
<!-- <input type="text" name="Date" id="Date" readonly><input type="button" onClick="SelectDate('Date1')" value="Select"><br> -->
<table>
<tr><td> <b>StartDate: </b></td><td><input type=text maxlength=10 size=10 name="srchstartDate" id="txtStartDate" readonly></td><td> <img id="ImgStartDate" title="Click on the Image" onClick="SelectDate('txtStartDate')" src="./images/calendar.gif" width="35" height="25 alt="" border="0" /></td></tr>
<tr/><tr/><tr/>
<tr><td> <b>EndDate: </b></td><td><input type=text maxlength=10 size=10 name="srchendDate" id="txtEndDate" readonly></td><td><img id="ImgEndDate" title="Click on the Image" onClick="SelectDate('txtEndDate')" src="./images/calendar.gif" width="35" height="25" alt="" border="0" /></td></tr>
</table>
<br><input type="checkbox" value="y" name="srchInZipFile"> Search the Content in ZIP files</input><br/><br/>
<input type="hidden" id="hideDate">
<input type="hidden" id="searchContent" name="searchContent">
<input type="hidden" id="searchInAuditLog" name="searchInAuditLog">
<input type="hidden" id="searchInErrorLog" name="searchInAuditLog">
<input type="hidden" id="searchInDebugLog" name="searchInAuditLog">
<input type="hidden" id="searchInZipFile" name="searchInAuditLog">
No.of.Records Per PAGE: <input type=text name="recordsPerPage" value="10" size=5/>
<input type=button value="SEARCH" onClick="submitForm()"> <input type=RESET value="CLEAR ALL FIELDS"></center>
</form>
</BODY>
</HTML>
|
|
From: Wolfgang F. <wf...@bi...> - 2010-11-19 16:17:42
|
Hi Amit,
You wrote:
>please can anyone suggest how can I execute this JavaScript Function
having HttpUnitOptions.setScriptingEnabled set to false.
You can't. Period.
Please read the FAQ javascript section for further info.
Cheers
Wolfgang
Am 19.11.10 16:57, schrieb Amit Oberoi:
> Hi,
> I am testing a web application which is more of a message tracker. The
> page I am stuck at present is a search page full of Java Script. To
> avoid JavaScript exceptions I have used
> HttpUnitOptions.setScriptingEnabled(false).
> My problem is the search button on which there is onClick event which
> submits the form via a JavaScript Fucntion submitForm(); there is no
> submit button for the search form except this search button. Because I
> have disabled the scripting even if I call
> button.doEventScript("onClick") the web page is not moving ahead.
> please can anyone suggest how can I execute this JavaScript Function
> having HttpUnitOptions.setScriptingEnabled set to false.
> My code snippet lokks like below:
> Button[] buttons = form.getButtons();
> for(int i=0; i < buttons.length; i++) {
> if(buttons[i].getAttribute("value").equalsIgnoreCase("search")) {
> boolean check =
> engine.createHandler(buttons[i]).doEventScript("onClick");
> System.out.println(check);
> response = b2bTracker.getCurrentPage();
> System.out.println(response.getTitle());
>
> }
> Submit Form finction looks like below
> function submitForm()
> {
> var Submitt = "true";
> var tBoxValue = document.getElementById("tbox").value;
> var tAreaValue = document.getElementById("tarea").value;
>
> if(document.getElementById("tbox").style.visibility == "visible")
> {
> if( !(tBoxValue == "") )
> {
> document.getElementById("searchContent").value =
> document.getElementById("tbox").value;
> }
> else
> {
> alert("Enter the Search Content in the TextBox");
> Submitt = "false";
> document.getElementById("tbox").focus();
> }
> }
> else if( document.getElementById("tarea").style.visibility == "visible")
> {
> if ( !(tAreaValue == "") )
> {
> document.getElementById("searchContent").value =
> document.getElementById("tarea").value;
> }
> else
> {
> alert("Enter the Search Content in the TextArea");
> Submitt = "false";
> document.getElementById("tarea").focus();
> }
> }
>
> auditLog = document.getElementById("audit").checked;
> errorLog = document.getElementById("error").checked;
> debugLog = document.getElementById("debug").checked;
>
> if(auditLog == false && errorLog == false && debugLog == false)
> {
> alert("Please Select atleast One type of LOG");
> Submitt = "false";
> }
> else
> {
> document.getElementById("searchInAuditLog").value = auditLog;
> document.getElementById("searchInErrorLog").value = errorLog;
> document.getElementById("searchInDebugLog").value = debugLog;
> }
>
> startDate = document.getElementById("txtStartDate").value;
> endDate = document.getElementById("txtEndDate").value;
>
> if(GetDate(startDate) > GetDate(endDate))
> {
> alert("StartDate shoudn't be greater than the EndDate");
> Submitt = "false";
> }
>
> document.getElementById("searchInZipFile").value
> = document.getElementById("srchInZipFile").checked;
>
>
> if(Submitt == "true")
> {
> document.searchForm.action = "mtracker.do";
> document.searchForm.submit();
> }
>
> }
> Thanks in antocipation of a positive response.
> Regards
> Amit
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
>
>
> _______________________________________________
> Httpunit-develop mailing list
> Htt...@li...
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
--
BITPlan - smart solutions
Wolfgang Fahl
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web: http://www.bitplan.de
BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl
|
|
From: Amit O. <oam...@ya...> - 2010-11-19 15:57:35
|
Hi,
I am testing a web application which is more of a message tracker. The page I am
stuck at present is a search page full of Java Script. To avoid JavaScript
exceptions I have used HttpUnitOptions.setScriptingEnabled(false).
My problem is the search button on which there is onClick event which submits
the form via a JavaScript Fucntion submitForm(); there is no submit button for
the search form except this search button. Because I have disabled the scripting
even if I call button.doEventScript("onClick") the web page is not moving ahead.
please can anyone suggest how can I execute this JavaScript Function having
HttpUnitOptions.setScriptingEnabled set to false.
My code snippet lokks like below:
Button[] buttons = form.getButtons();
for(int i=0; i < buttons.length; i++) {
if(buttons[i].getAttribute("value").equalsIgnoreCase("search")) {
boolean check = engine.createHandler(buttons[i]).doEventScript("onClick");
System.out.println(check);
response = b2bTracker.getCurrentPage();
System.out.println(response.getTitle());
}
Submit Form finction looks like below
function submitForm()
{
var Submitt = "true";
var tBoxValue = document.getElementById("tbox").value;
var tAreaValue = document.getElementById("tarea").value;
if(document.getElementById("tbox").style.visibility == "visible")
{
if( !(tBoxValue == "") )
{
document.getElementById("searchContent").value =
document.getElementById("tbox").value;
}
else
{
alert("Enter the Search Content in the TextBox");
Submitt = "false";
document.getElementById("tbox").focus();
}
}
else if( document.getElementById("tarea").style.visibility == "visible")
{
if ( !(tAreaValue == "") )
{
document.getElementById("searchContent").value =
document.getElementById("tarea").value;
}
else
{
alert("Enter the Search Content in the TextArea");
Submitt = "false";
document.getElementById("tarea").focus();
}
}
auditLog = document.getElementById("audit").checked;
errorLog = document.getElementById("error").checked;
debugLog = document.getElementById("debug").checked;
if(auditLog == false && errorLog == false && debugLog == false)
{
alert("Please Select atleast One type of LOG");
Submitt = "false";
}
else
{
document.getElementById("searchInAuditLog").value = auditLog;
document.getElementById("searchInErrorLog").value = errorLog;
document.getElementById("searchInDebugLog").value = debugLog;
}
startDate = document.getElementById("txtStartDate").value;
endDate = document.getElementById("txtEndDate").value;
if(GetDate(startDate) > GetDate(endDate))
{
alert("StartDate shoudn't be greater than the EndDate");
Submitt = "false";
}
document.getElementById("searchInZipFile").value
= document.getElementById("srchInZipFile").checked;
if(Submitt == "true")
{
document.searchForm.action = "mtracker.do";
document.searchForm.submit();
}
}
Thanks in antocipation of a positive response.
Regards
Amit
|
|
From: <rw...@co...> - 2010-09-15 14:40:06
|
Hi I am trying to use HTTPUnit1.6.2 and I am getting the following error: java.io.EOFException Unexpexted end of ZLIB Inputstream. I have see this error in postings on the web but assoiciated with a way old JDK .. I am using 1.6.11.. Am I missing something ? Thanks Ronny |