我有以下用于自动完成下拉列表的selenium自动化代码:
@FindBy(xpath = "//*[@id='s2id_customer-name-search']/a")
private static WebElement customerDrop;
@FindBy(id = "s2id_autogen5_search")
private static WebElement searchField;
public static void searchByCustomer(String customer) {
customerDrop.click();
new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(searchField()));
searchField.sendKeys(customer);
new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(searchResult()));
searchResult.click();
}
对页面进行了更改以解决清除字段的问题,现在自动化不再自动完成。手动输入仍会触发自动完成,但不会触发我的自动化代码。
还有另一种方法可以触发自动完成吗?