Re: I can not open many websites
"real self" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear Wolfgang,
Thanks for your response.
If I understand your code right you are opening www.google.com and expect to
> see a link for httpunit there.
>
There is a link named "Advertising Programs" in the .www.google.com. I use
the following statement to find it.
WebLink httpunitLink = response.getFirstMatchingLink(
WebLink.MATCH_CONTAINED_TEXT, "Adver" );
Then I use the statement " response = httpunitLink.click();//" which gives
me an exception there.
I also try other websites, such as mapquest.com, but the error happens every
time. I do run your example successfully.
>
> A question like this seems IMHO more suitable for the new httpunit
> users list.
>
I have thought to send an email to the user list, as I did it in other
groups. But it seems that the user list is not active. I found there was no
archive in the httpunit-user maillist in your sourceforge website.
If you think someone will response in the user list, I will do that next
time.
Thanks again.
Sincerely Yours.
Jiangfan
> >
> > Hi, All,
> >
> > I could not open many websites, but I could run your example for the
> > http://www.meterware.com.
> >
> > I must make some mistakes somewhere. Could you please be nice to point
>
> > it out for me? Thanks.
> >
> > The problem is the statement " response = httpunitLink.click()";
> >
> > Thanks.
> >
> > Jiangfan
> >
> >
> > My code:
> > -------------------Begin--------------
> >
> > package jfshi;
> >
> > import com.meterware.httpunit.GetMethodWebRequest;
> > import com.meterware.httpunit.WebConversation;
> > import com.meterware.httpunit.WebLink;
> > import com.meterware.httpunit.WebRequest;
> > import com.meterware.httpunit.WebResponse;
> >
> > public class Googlemaps {
> > public static void main( String[] params ) {
> > try {
> > // create the conversation object which will maintain
> > state for us
> > WebConversation wc = new WebConversation();
> >
> > // Obtain the main page on the maps google web site
> > WebRequest request = new GetMethodWebRequest(
> > "http://www.google.com" );
> > WebResponse response = wc.getResponse( request );
> >
> > // find the link which contains the string "HttpUnit" and
> > click it
> > WebLink httpunitLink = response.getFirstMatchingLink(
> > WebLink.MATCH_CONTAINED_TEXT, "Adver" );
> > System.out.println(httpunitLink.getURLString().toString())
> > ;
> >
> > response = httpunitLink.click();//
> > <==========================SOME EXCEPTIONS HAPPEND HERE.
> >
> >
> > for(int i=0;i<response.getLinks().length;i++){
> > WebLink tmp=response.getLinks()[i];
> > System.out.println(tmp.getText().toString());
> > }
> >
> > } catch (Exception e) {
> > System.err.println( "Exception: " + e );
> > System.out.println("wrong!!");
> > }
> > }
> > }
> > ------------------Over---------------------------
> >
> >
> >
>
>
> *
> *
> *BITPlan* - smart solutions
> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
> Tel. +49 1805 - BITPLAN / +49 1805 248 752, Fax +49 2154 811-481
> Web: http://www.bitplan.de
> bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548,
> Geschäftsführer: Wolfgang Fahl
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop