• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HttpUnit help urgent........

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PROBLEM:
---------
(1) There are 3 forms on "https://www.shopping.hp.com/cgi-bin/hpdirect/shopping/scripts/profile/signin_view.jsp"
page [1.qsrSearch 2.searchTop 3.signinForm] but when I run the code the code is only able to get form 1 & 2 it does not find "signinForm"......can anybody help me out with this......
(2) This code works fine sometimes but sometimes same code throws an "java.io.IOException" .... though I am not sure it seems to be related to sessions....can anybody help...


CODE:
-----
import java.net.URL;
import java.security.Security;
import com.meterware.httpunit.*;

public class SignIn {

public static void main(String[] args){

String host = "www.shopping.hp.com/cgi-bin/hpdirect/shopping/scripts/home/home.jsp";

WebConversation wc = new WebConversation();
WebRequest request = new GetMethodWebRequest("http://" + host);
try{
WebResponse response = wc.getResponse(request);

WebConversation wc1 = new WebConversation();
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
HttpUnitOptions.getExceptionsThrownOnScriptError());

WebRequest SignIn_request = new GetMethodWebRequest("https://www.shopping.hp.com/cgi-bin/hpdirect/shopping/scripts/profile/signin_view.jsp");

WebResponse SignIn_response = wc1.getResponse(SignIn_request);

WebForm SignIn_form [] = SignIn_response.getForms();
for (int i=0; i<SignIn_form.length; i++)
{
System.out.println("FORM NAME : " + SignIn_form[i].getName());
}
}
catch(Exception e){
System.out.println("EXCEPTION : " + e);
}
}
}


PROBLEM:
---------
(1) There are 3 forms on "https://www.shopping.hp.com/cgi-bin/hpdirect/shopping/scripts/profile/signin_view.jsp"
page [1.qsrSearch 2.searchTop 3.signinForm] but when I run the code the code is only able to get form 1 & 2 it does not find "signinForm"......can anybody help me out with this......
(2) This code works fine sometimes but sometimes same code throws an "java.io.IOException" .... though I am not sure it seems to be related to sessions....can anybody help...

Thanks in Advance.....
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. I navigated to this URL: https://www.shopping.hp.com/cgi-bin/hpdirect/shopping/scripts/profile/signin_view.jsp

It was NOT the "sign in" page (like I was redirected), but has a link to the signin page. It had two forms, 1.qsrSearch 2.searchTop .

2. I navigated to the signin page from there. It's got three forms.

3. I see another URL in your code, so I navigate to it http://www.shopping.hp.com/cgi-bin/hpdirect/shopping/scripts/home/home.jsp. That one takes me to an error page. "We're sorry! The page you're trying to reach is unavailable."

4. I paste in the signin URL again and this time it takes me to an error page, too.

The pages not being found could cause your IOException?
[ April 06, 2005: Message edited by: Carol Enderlin ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic