import iexplorer.InternetExplorer; import iexplorer.IWebBrowserApp; import java.io.*; public class Test { public static void main(String args[]) { try { // Instantiate an InternetExplorer InternetExplorer ie = new InternetExplorer(); // Get IWebBrowserApp IWebBrowserApp app = ie.getIWebBrowserApp(); // Make the browser visible app.setVisible( true ); // If IE is trying to load any default pages, stop it. app.Stop(); System.out.println( "Page loading stopped successfully" ); // Get a buffered reader to read user input. BufferedReader in = new BufferedReader( new InputStreamReader( System.in )); for (;;) { System.out.print( "Enter command: \"load\", \"title\", \"url\" or \"quit\"> " ); String cmd = in.readLine().trim(); if ( cmd.equalsIgnoreCase( "load" )) { // Load URL System.out.print( "Enter URL> " ); String line = in.readLine(); if ( ! line.equals( "" )) { // Tell browser to load the URL app.Navigate( line ); } } else if ( cmd.equalsIgnoreCase( "title" )) { System.out.println( "Location title is " + app.getLocationName()); } else if ( cmd.equalsIgnoreCase( "url" )) { System.out.println( "Location URL is " + app.getLocationURL()); } else if ( cmd.equalsIgnoreCase( "quit" )) { app.Quit(); System.exit( 0 ); } else if ( ! cmd.equals( "" )) System.out.println( "Unknown command \"" + cmd + "\"" ); } } catch (Exception ex) { ex.printStackTrace(); } } }