繁体   English   中英

Selenium 找到 select 节点的 xpath

[英]Selenium find xpath of select node

我正在尝试为以下内容生成 xpath:

    <select data-bind="options: PrinterLabelTypes, optionsValue: 'value', optionsText: 
    'value', value: NewPrinterLabelTypeText, optionsCaption: GetText('SelectLabelType')">. 
     <option value="">Choose Printer Label Type...</option><option 
    value="Batch">Batch</option><option value="Despatch">Despatch</option>
    </select>

我尝试了以下方法:

    //select[@data-bind='value: NewPrinterLabelTypeText']

但我没有得到任何回报。 我错过了什么吗。 有没有办法使用上面的格式来做到这一点?

当您的定位器使用部分属性值时,您必须使用contains

//select[contains(@data-bind,'value: NewPrinterLabelTypeText')] 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM