Press Enter Key in Selenium

If you are working with a SearchBox using Selenium. In which you have to type something and you have to press Enter to search. You can do it in the following way...

// this sends an Enter to the element

selenium.type("locator", Keys.ENTER);

// The below code sends the "Any text" and then confirms it with Enter

selenium.type("locator", "Any text" + Keys.ENTER);

Here locator means You have to add the TextBox's Id.  

or try this



selenium.keyDown("locator of element", "\\13");

Where 13 is the ASCII value of Enter Key.. 

Hope this may help you.


  1. Your information about Selenium scripts is really interesting. Also I want to know the latest new techniques which are implemented in selenium. Can you please update it in your website?
    Selenium Training in Chennai|Selenium Course in Chennai

  2. I went through your blog, it’s totally awesome. Being most popular automation testing tool, selenium is used in automation software testing process. Selenium Course in Chennai | Best Selenium training institute in Chennai