我想输入日期如下:2015/05/05进入该领域。我们的想法是使用ends-with命令。到目前为止,以下没有工作
//input[ends-with(@id,'_ExecutionDate')and contains(.,'ExecutionDate')][@class='emphasis']
//div[ends-with(@id,'_ExecutionDate')and contains(.,'ExecutionDate')][@class='emphasis']
这是来自Selenium的选择选项的XPATH: 的xpath =(//输入[@id =' 44d02654-39b3-447e-904D-8d3c7ca016b6.ExecutionDate'])[3]
她是来自Firebug的xpath:
.//*[@id='44d02654-39b3-447e-904d-8d3c7ca016b6.ExecutionDate']
这是一段代码:
<div class="pull-right" data-bind="visible: view.isIndividual"><!-- ko foreach: signingParties -->
<a id="44d02654-39b3-447e-904d-8d3c7ca016b6.ExecutionDate" class="emphasis" style="margin-right:5px" data-bind="visible: !$root.locked(), click: $root.transferOfLand.view.editExecutionDates, valName: 'ExecutionDate', text: view.executionDateDisplay()" href="#" name="44d02654-39b3-447e-904d-8d3c7ca016b6.ExecutionDate" data-val="LandTransferDocument.Transferor.0.SigningParty.ExecutionDate">Add Execution Date...</a>
<span id="44d02654-39b3-447e-904d-8d3c7ca016b6.ExecutionDate" style="margin-right: 5px; display: none;" data-bind="visible: $root.locked(), valName: 'ExecutionDate', text: view.executionDateDisplayReadOnly()" name="44d02654-39b3-447e-904d-8d3c7ca016b6.ExecutionDate" data-val="LandTransferDocument.Transferor.0.SigningParty.ExecutionDate">No Execution Date</span>
答案 0 :(得分:2)
ends-with()
是XPath 2.0
的一部分,因此无法在此处使用,请参阅以下详细信息:
相反,请使用contains()
:
//input[contains(@id,'ExecutionDate')]
或者,有一个带有 CSS选择器的结尾:
input[id$=ExecutionDate]