1 38 package com.gargoylesoftware.htmlunit; 39 40 import com.gargoylesoftware.htmlunit.html.HtmlPage; 41 import java.net.URL ; 42 43 50 public class Version { 51 56 public static void main( final String args[] ) throws Exception { 57 if( args.length == 1 && args[0].equals("-SanityCheck") ) { 58 new Version().runSanityCheck(); 59 return; 60 } 61 62 final Package aPackage = Package.getPackage("com.gargoylesoftware.htmlunit"); 63 64 System.out.println("HTMLUnit"); 65 System.out.println("Copyright (C) 2002, 2005 Gargoyle Software Inc. All rights reserved."); 66 67 if( aPackage != null ) { 68 System.out.println("Version: "+aPackage.getImplementationVersion()); 69 } 70 } 71 72 73 private void runSanityCheck() throws Exception { 74 final WebClient webClient = new WebClient(); 75 final HtmlPage page = (HtmlPage)webClient.getPage( 76 new URL ("http://htmlunit.sourceforge.net/index.html") ); 77 page.executeJavaScriptIfPossible("document.location", "SanityCheck", false, null); 78 System.out.println("SanityCheck complete."); 79 } 80 81 } 82 | Popular Tags |