How to type the Enter/Return key in Selenium

Java

In Java, use the org.openqa.selenium.Keys enumeration.

import org.openqa.selenium.Keys
driver.findElement(By.id("myID")).sendKeys(Keys.RETURN);

Python

In Python, use the Keys enumeration from selenium.webdriver.common.keys.

from selenium.webdriver.common.keys import Keys
driver.find_element_by_id("myID").send_keys(Keys.RETURN)

C#

In C#, use the OpenQA.Selenium.Keys enumeration.

using OpenQA.Selenium.Keys
driver.FindElement(By.Id("myID")).SendKeys(Keys.Return);