How to specify ENTER button functionality in Selenium WebDriver code?

How to specify ENTER button functionality in Selenium WebDriver code?

Hi Miro Vasil,

I’m assuming you are writing the code in Java, so you can use the below code to find the element and then click on it:

driver.findElement(By.id(""Value"")).sendKeys(Keys.ENTER);

or

driver.findElement(By.id(""Value"")).sendKeys(Keys.RETURN);

For this to work, you should also import the “org.openqa.selenium.Keys” and “package.”