/**
 * Google.java
 * Open Google webpage and search for "Selenium RC".
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class Google
{
  public static void main(String[] args)
  {
    final String sServerHost  = "localhost";
    final int iServerPort     = 4444;
    final String sBrowserType = "*iexplore"; // For Firefox, use *firefox
    final String sBaseUrl     = "http://www.google.ca/";
 
    DefaultSelenium oDefaultSelenium = new DefaultSelenium(sServerHost, iServerPort, sBrowserType, sBaseUrl);
    oDefaultSelenium.start();           // Start Selenium.
    oDefaultSelenium.setSpeed("5000");  // Wait 5 seconds for every instructions so that you can see what Selenium is doing.
 
    // Open the main google webpage.
    oDefaultSelenium.open("http://www.google.ca/index.html"); 
 
    // Type "Selenium RC" into the search input field.
    oDefaultSelenium.type("name=q", "Selenium RC"); // Use name locator to identify the search input field.
 
    // Click on "Google Search" button
    oDefaultSelenium.click("xpath=//input[@name='btnG']");
 
    // Close the browser.
    oDefaultSelenium.stop();
  }
}
