I am using Selenium Java. I need to enter value into text box and press down arrow to select suggestions and then press Enter key.
So, my question is how to press Down Arrow key followed by "Enter" key?
You can import Keys
and use these.
import org.openqa.selenium.Keys
WebElement.sendKeys(Keys.DOWN);
WebElement.sendKeys(Keys.RETURN);
Edit
You could probably use one sendKeys()
call:
WebElement.sendKeys(Keys.DOWN, Keys.RETURN);
For Ruby, this would be:
input_element = @driver.find_element(:id,'input_id')
input_element.send_keys(:arrow_down)
A list of special character keys can be found here
input_element = @driver.find_element(:id,'input_id')
input_element.send_keys(:arrow_down)
A list of special character keys can be found here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With