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!
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.