Looking for the list with what user has typed Trying to automate the City Selection but unable to get the Origin City List when I type some matching letters. Rather I am getting the default list displayed in the dropdown
Code trials:
driver.get("https://www.makemytrip.com");
driver.findElement(By.xpath("//input[@id='fromCity']")).click();
String TypeSrc="R";
String sourceCity="Ranchi";
WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement el= wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@type='text' and @role='combobox']")));
el.sendKeys(TypeSrc);
List<WebElement> li=driver.findElements(By.xpath("//ul[@role='listbox']//li//div//p"));
for(int i=0;i<li.size();i++){
{
System.out.println(li.get(i).getText());
}
Actual output I am getting:
Mumbai, India
Chhatrapati Shivaji International Airport
Delhi, India
Delhi Airport
Bangkok, Thailand
Suvarnabhumi Airport
Bangalore, India
Bengaluru International Airport