All pastes #367475 Raw Edit

Someone

public text v1 · immutable
#367475 ·published 2007-02-22 11:09 UTC
rendered paste body
private void generatePages(String City, String Branche, String rootfolder) throws SAXException, MalformedURLException, IOException{
        HttpUnitOptions.setScriptingEnabled( false );
        System.out.println("Test started!");
        String source;
    WebConversation wc = new WebConversation();
    WebResponse resp = wc.getResponse("http://wappc.pagesjaunes.fr/pj.cgi"); //We go to the form.
    WebForm form = resp.getForms()[0];   // select the first form in the page
        System.out.println("Form-Name: "+form.getName());
        form.setParameter( "FRM_ACTIVITE", Branche );      // Insert values...
        form.setParameter( "FRM_LOCALITE", City );         // Insert values...
        System.out.println("Submitting...");
        resp = form.submit();                              //We submit the filled form.
        
        
        HttpUnitOptions.setScriptingEnabled( true );
        
    System.out.println("Next page...");
    WebLink       link = resp.getLinkWithImageText( "Page suivante" );                       // find the link
    System.out.println("Go..");
    link.click(); // follow it
    WebResponse   jdoc = wc.getCurrentPage();       
   
    
    
    
    source = readout(jdoc.getInputStream());
    
     writeCode(source, new File(rootfolder+"TT!"+System.currentTimeMillis()+".html")); //We write the source into a file.
          System.out.println("Test done!");      
          
    } //END of FUNCTION