【发布时间】:2021-04-12 14:04:30
【问题描述】:
如何从下面的 html 中获取下拉列表中第二个元素的 xpath 我正在使用带有 specflow 和 selenium 的 C#
在 UI 中,属性类型下有一个静态下拉列表,其中有两个选项 Residential 和 Business 我需要找到第二个选项。
<select class= "form-control ng-pristine ng-empty ng-invalid-required ng-touched" type="text"
id="propertyType" name="propertyTypr" ng-modal="lead.currentLeadContact.IsResidential" required
style>
<option value="? object:null ?"></option>
<option value="true">Residintial</option>
<option value="false">Business</option>
</select>
已经试过了
//select[@id='prorpertyType']/option[@value='false' and . ='Business']
和
//select[@id='propertyType' and @value='1'] same xpath with value 0 and 2
如果有人可以帮助我,我将不胜感激。
【问题讨论】:
标签: c# selenium xpath css-selectors html-select