Hey @jino, good that you are finding alternatives to do a task. Talking about pressing enter, enter is a keystroke and is considered as same in selenium aswell.
When you enter any keyword, you use .sendKeys("Your keyword");
For pressing enter also you do the similar thing but instead of writing enter you make enter a keystroke.
The step being this:
driver.findElement(By.id("id of your text bar")).sendKeys("Your keyword",Keys.ENTER);
Hope this was of some help.
To know more about Java, It's recommended to join our Java Training in Chennai today.