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 A
driver.findelement(By.(locator(locator details)).sendKeys(Keys.ARROW-DOWN,Keys.RETURN)
You can import Keys and use these.
import org.openqa.selenium.Keys
WebElement.sendKeys(Keys.DOWN);
WebElement.sendKeys(Keys.RETURN);
Edit
Could probably also be used in one sendKeys() call
WebElement.sendKeys(Keys.DOWN, Keys.RETURN);
using Keys = OpenQA.Selenium.Keys;
//moves down arrow key from keyboard to the list of dropdown
IWebElement.SendKeys(Keys.Down);
//Hits Enter on the selected list from the dropdown
IWebElement.SendKeys(Keys.Return);
This will work.
Even you can concatenate both the Down and Enter in a single statement.
import org.openqa.selenium.Keys
WebElement.sendKeys(Keys.DOWN + Keys.ENTER);
input_element = @driver.find_element(:id,'input_id')
input_element.send_keys(:arrow_down)
A list of special character keys can be found here
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