【问题标题】:selenium aria-activedescendant multiple select box javaselenium aria-activedescendant 多选框 java
【发布时间】:2017-12-07 13:32:56
【问题描述】:

我需要自动选择 selenium 中的多下拉框。下面给出了包含下拉列表的 html 代码。每个组件的 html 代码都是使用 firebug 获取的。

<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen346" tabindex="-1" placeholder="" style="width: 269px;" aria-activedescendant="select2-result-label-367">

当我更改列表中的选择值时,我的 aria-activedescendant="select2-result-label-367" 值正在发生变化

enter image description here

enter image description here

【问题讨论】:

    标签: java google-chrome selenium selenium-chromedriver


    【解决方案1】:

    根据您共享的HTML,您可以使用以下代码行来选择多下拉框:

    driver.findElement(By.xpath("//li[@class='select2-search-field']//input[@class='select2-input' and contains(@id,'id_autogen')]")).click();
    

    【讨论】:

    • 我有这个错误:org.openqa.selenium.WebDriverException:未知错误:元素 在点 (256, 183) 不可点击。其他元素会收到点击:
        ...
    • 这是我的 htm 表单:
    • 太棒了!!!所以你原来的自动选择多下拉框的问题现在已经解决了。请点击我的答案旁边的勾号Accept Answer。对于 元素在该点不可点击,请参阅此 QA Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click:
    • 你能帮我做这个测试吗?
    • 我该如何选择 KOKOKO 值:
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签