|
From: <pas...@ya...> - 2004-02-20 11:22:47
|
I tried to be more clear on my explanation.
java.net.URL url = new
java.net.URL("http://eluard/sasprod");
WebClient webClient = new WebClient() ;
HtmlPage page = (HtmlPage) webClient.getPage(url);
logt(page.toString());
try {
java.util.List l = page.getAllForms() ;
HtmlForm form = (HtmlForm)l.get(0) ;
HtmlButtonInput buttonInput = (HtmlButtonInput)
form.getInputByName("Valider");
HtmlPage secondpage = (HtmlPage)form.submit() ;
logt("a => "+buttonInput.getOnClickAttribute()) ;
logt(secondpage.toString());
logt(secondpage.getAllForms().toString()) ;
logt("URL=>
"+secondpage.getWebResponse().getUrl().toString()) ;
}
catch(com.gargoylesoftware.htmlunit.ElementNotFoundException
ex) {
logt("Form not found") ;
}
In this example, If I understood correctly.
1- I load the first page : http://eluard/sasprod (I
verified, it's ok)
2- I collect the form of the first page (I verified,
it's ok)
3- I click on the button (I don't know if it's ok)
4- I receive the new page in the object "secondpage".
The problem appears with this new page. If I tested
the url or I dump the content of this page, I receive
the contents of my first page and not the contents of
the second.
I don't understand why.
To explain what I want to do :
load page 1 => simulate click => load result html page
after my click => change forms value => submit the
form of my second page => collect the third page =>
../..
I hope that it's more clear.
Pascal.
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
|