//-Begin----------------------------------------------------------------

  import java.util.*;
  import org.openqa.selenium.*;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.chrome.ChromeOptions;
  import org.openqa.selenium.remote.*;

  public class selenium {

    public static void main(String[] args) {

      //-Set path to chromedriver---------------------------------------
      System.setProperty(
        "webdriver.chrome.driver",
        "C:/Dummy/Selenium/chromedriver.exe"
      );

      //-Set path to Chrome browser-------------------------------------
      Map<String, Object> chromeOptions = new HashMap<String, Object>();
      chromeOptions.put("binary", "C:/Google/Chrome/Application/chrome.exe");
      DesiredCapabilities capabilities = DesiredCapabilities.chrome();
      capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);

      WebDriver webDriver = new ChromeDriver(capabilities);

      webDriver.get("http://www.google.com");
      try {
        Thread.sleep(5000);
      } catch (Exception e) {

      }

      WebElement searchBox = webDriver.findElement(By.name("q"));
      searchBox.sendKeys("ChromeDriver");
      searchBox.submit();
      try {
        Thread.sleep(5000);
      } catch (Exception e) {

      }

      webDriver.close();
      webDriver.quit();

    }

  }

//-End------------------------------------------------------------------