我无法自动执行下拉字段。下拉字段是一个reactjs可创建的下拉列表,用户可以在其中创建新值或选择现有值。并且在HTML片段中以开头。因此,我们不能使用“选择类”或“动作类”来使此下拉字段自动化。
<div class="form-group col-md-6">
<div class="col-md-12"><label for="data-provider">Data Provider<span class="red_star">* </span></label></div>
<div class="col-md-10">
<div class="Select data-provider is-clearable is-searchable Select--single">
<div class="Select-control">
<div class="Select-multi-value-wrapper" id="react-select-2--value">
<div class="Select-placeholder">Enter or Select an existing provider</div>
<div class="Select-input" style="display: inline-block;">
<input id="data-provider" aria-activedescendant="react-select-2--value" aria-expanded="false" aria-haspopup="false" aria-owns="" role="combobox" value="" style="box-sizing: content-box; width: 5px;">
<div style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-size: 14px; font-family: Avenir; font-weight: 400; font-style: normal; letter-spacing: normal; text-transform: none;"></div>
</div>
</div>
<span class="Select-arrow-zone"><span class="Select-arrow"></span></span>
</div>
</div>
</div>
<div class="col-md-12"><small class="text-muted">Enter a Data Provider that's not in the list, then hit enter/return</small></div>
<div class="col-md-12" id="validation-data-provider" style="display: none;"><small style="color: rgb(169, 68, 66);">This field is required</small></div>
</div>
答案 0 :(得分:0)
我认为这是一个组合框。您可以尝试使用任何定位器将键发送到必填字段。 例如 - driver.findelement(By.xpath(// div [@ role ='combobox'])。sendKeys(“输入或选择现有商品”)。
请检查。