How to select an option from an autocomplete field in selenium

@Test
  public void DropDown() throws Exception{
Thread.sleep(9000);
    String str;
    str=driver.findElement(By.id("edit-submitted-country")).getText();
    System.out.println(str);
String[] s=str.split("\n");
System.out.println(s.length);
for (int i = 0; i < s.length; i++) {
if(s[i].equalsIgnoreCase("India"))
{
driver.findElement(By.id("edit-submitted-country")).sendKeys(s[i]);
System.out.println(s[i]);
}
}
  }

Comments