Я пытаюсь протестировать туристический сайт. Когда я ввожу код города, из списка должен быть выбран правильный аэропорт. Однако он вводит код города и не выбирает город из списка.
@org.testng.annotations.Test
public void flightTest() throws InterruptedException {
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
driver.get("https://phptravels.net/");
//--------------- Departure -------------------
WebElement fromBox = driver.findElement(By.name("from"));
fromBox.sendKeys("DAC");
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
By lst1 = By.xpath("//div[@class='most--popular-from fadein results-container-from rounded-2 shadow border-0']//button[text()='DAC']");
Thread.sleep(1000);
WebElement from = wait.until(ExpectedConditions.visibilityOfElementLocated(lst1));
Thread.sleep(1000);
from.click();
//--------------- Destination -------------------
WebElement toBox = driver.findElement(By.name("to"));
toBox.sendKeys("JED");
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
By lst2 = By.xpath("//div[@class='d-flex align-items-center p-2 to--insert overflow-hidden result-option']//button[text()='JED']");
WebElement to = wait.until(ExpectedConditions.visibilityOfElementLocated(lst2));
Thread.sleep(1000);
to.click();
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... pdown-list