无法从反应-选择下拉Robotframework中选择选项



有一个名为"sampleType"其中有几个值"AB1, AB2,…AB6" .

当我手动点击下拉菜单时,AB1默认被选中。

我需要根据用户输入选择其他值,即AB2-AB6。

我在这里问了很多问题,但没有找到合适的。

下面是HTML片段。

请帮忙&提前感谢!

<div class="react-select" id="sampleType" role="presentation">
<div class="Select react-select has-outline has-value Select--single">
<input name="sampleType" type="hidden" value="AB1">
<div class="Select-control">
<span class="Select-multi-value-wrapper" id="react-select-sampleType--value" aria-label="Select Menu. AB1 selected.">
<div class="Select-value">
<span class="Select-value-label" role="option" aria-selected="true" id="react-select-sampleType--value-item">AB1</span>
</div>
<div aria-expanded="false" aria-owns="" aria-activedescendant="react-select-sampleType--value" aria-disabled="false" class="Select-input datagrid-row-actions" role="combobox" style="border: 0px none; width: 1px; display: inline-block;" tabindex="0"></div>
</span>
<span class="Select-arrow-zone">
<span class="Select-arrow"></span></span></div></div><div class="footer-height" role="alert"><div class="error"></div></div></div>

从您的代码片段来看,您正在使用一个组合框,其名称属性为"sampleType"?然后你就可以输入你想要的东西了。它看起来像这样:

driver.find_element_by_name("sampleType").send_keys(valueFromUserInput)

您需要定位"输入";标记,并将输入(send_keys)发送给它

最新更新