How to select value from Dropdown without using Select class, Becuase in have dropdown as listbox in the span not select?

∥☆過路亽.° 提交于 2019-12-02 12:25:00

Try smth like this:

Actions action = new Actions(driver);    
WebElement optionsList = driver.findElement(By.xpath("//span[contains(@class, 'k-dropdown-wrap')]"));
action.moveToElement(optionsList);

List<WebElement> options = driver.getElemets(By.xpath("//span[contains(@class, 'k-input')]"));
for(WebElement option : options) {
    if (option.getText().equals("Texas")) {
        option.click();
    }
}

Stop writing strange xpath to elements :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!