4Manuals

  • PDF Cloud HOME

如何从“ mdb-select”列表中选择选项 Download

    春季启动-Couchbase AbstractCouchbaseConfiguration-如何避免覆盖不必要的方法 我不知道(未解决的编译问题:) 加载数据并推送到未显示的RecyclerView中 调用Model类的函数时出现java.lang.NullPointerException 字符串数组在for循环中初始化时忽略索引0 Spring MVC @ModelAttribute未填充AJAX发布请求 需要建议在Java中使用哪个数据库/存储来存储RaftLogs(实现Raft Consensus Algorithm) Flutter:Java使用或覆盖已弃用的API @ EnableOAuth2Sso和@EnableResourceServer(同一应用程序中的客户端和资源行为) 中断可运行线程的问题

因此,我尝试使用以下代码从类型mdb-select的列表中选择一个选项:

Select dropdown = new Select(driver.findElement(By.id("selectEntidaBancaria")));

dropdown.selectByVisibleText("Davivienda S.A.");

但是Java向我显示了以下错误:

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "mdb-select"

您可以使用哪种方法从该类型的列表中选择一个选项?

1 个答案:

答案 0 :(得分:0)

因此,由于您的列表不是标准选择,因此Selenium Select失败。相反,您应该能够执行以下操作。

driver.findElement(By.id("selectEntidaBancaria")).click(); //click on the list to bring up choices

wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//mdb-select[contains(.,'Davivienda S.A.')]")); //wait for dropdown to appear and be clickable

driver.findElement(By.xpath("//mdb-select[contains(.,'Davivienda S.A.')]")).click(); // and click on it

改编自Selenium tests are not able to interact with any of the elements的Python答案



Similar searches
    DataTables使用现有数据折叠行 将标记添加到Date_Dim表以方便按年过滤 过渡unmountOnExit跳过动画 Flutter网站网址导航 在2D字符网格中搜索单词