title: Selenium Webdriver to handle java script text box
body: <p>I am trying to specify zip code to a input field to fetch the restaurant locations. I am able to specify the zip code and unable to hit the enter key. As its doesn't has enter button it needs to be handled via javascript.  Need help in resolving issue:</p>
  
  <pre><code>public static void main(String[] args) {
      // TODO Auto-generated method stub
      WebDriver driver = new FirefoxDriver();
      String baseURL = "http://www.thecheesecakefactory.com/";
      driver.get(baseURL);
      // Go to Menu
      driver.findElement(By.xpath("//*[@id='topNav']/li[1]/a")).click();
      // Click on Pizza
      driver.findElement(By.xpath("//*[@id='firstScroller']/li[7]/a")).click();
      // Select Hawallian Pizza
      driver.findElement(By.xpath("//*[@id='secondScroller']/li[6]/a")).click();
      //String pageTitle = "Hawaiian Pizza";
      String aTitle = driver.getTitle();
      if (aTitle.equalsIgnoreCase("Hawaiian Pizza")){
          System.out.println("Yes its Hawaiian Pizza");
          System.out.println(driver.getTitle());
      }
      //Click to order and get locations
      driver.findElement(By.xpath("//*[@id='receiptMenu']/div[1]/div[3]/div/a/b")).click();
      WebElement element;
      element = driver.findElement(By.xpath("//*[@id='location_box']/div[2]/input"));
      element.sendKeys("84604", Keys.ENTER);
  }
  </code></pre>