Try this:
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("email")).sendKeys("testing@netexam.com");
driver.findElement(By.id("email")).sendKeys(Keys.RETURN); //Send Enter Key
Question
I ran in to a situation where sometimes clicking on a Submit button doesn't work in Selenium Webdriver. The same functionality could be obtained by pressing the Enter button.
Here, after entering the value in text box, I want Selenium WebDriver to press Enter key. How would I do that? I'm using java
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("email")).sendKeys("testing@netexam.com");
Thanks in advance!
Solution
Try this:
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("email")).sendKeys("testing@netexam.com");
driver.findElement(By.id("email")).sendKeys(Keys.RETURN); //Send Enter Key