我需要在vaadin表中搜索两个字符串的日期和位置,当点击两个字符串所在的行时,我创建了一个xpath
.//div[1]/div[2]/div/div[3]/div[1]/table/tbody/tr/td/div[contains(text(), 'PL')]
我想添加另一个包含
[contains(text(),'2012-12-12')]
这是代码
<tbody>
<tr class="v-table-row" style="">
<tr class="v-table-row-odd" style="">
<td class="v-table-cell-content" style="width: 316px;">
<div class="v-table-cell-wrapper" style="width: 316px;">NY</div>
</td>
<td class="v-table-cell-content" style="width: 301px;">
<div class="v-table-cell-wrapper" style="width: 301px;">2012-07-10</div>
</td>
<td class="v-table-cell-content" style="width: 602px;">
<div class="v-table-cell-wrapper" style="width: 602px;">fhfhf</div>
</td>
</tr>
<tr class="v-table-row v-selected" style="">
<td class="v-table-cell-content" style="width: 316px;">
<div class="v-table-cell-wrapper" style="width: 316px;">PL</div>
</td>
<td class="v-table-cell-content" style="width: 301px;">
<div class="v-table-cell-wrapper" style="width: 301px;">2012-07-15</div>
</td>
<td class="v-table-cell-content" style="width: 602px;">
<div class="v-table-cell-wrapper" style="width: 602px;">holiday in weekend test</div>
</td>
</tr>
<tr class="v-table-row-odd" style="">
<td class="v-table-cell-content" style="width: 316px;">
<div class="v-table-cell-wrapper" style="width: 316px;">PL</div>
</td>
<td class="v-table-cell-content" style="width: 301px;">
<div class="v-table-cell-wrapper" style="width: 301px;">2012-07-24</div>
</td>
<td class="v-table-cell-content" style="width: 602px;">
<div class="v-table-cell-wrapper" style="width: 602px;">istotny test raportu</div>
</td>
</tr>
</tbody>
</table>
答案 0 :(得分:0)
使用XPath and
操作,如下所示:
.//div[1]/div[2]/div/div[3]/div[1]/table/tbody/tr/td/div[contains(text(), 'PL') and contains(text(),'2012-12-12')]
您还应该能够将其表达为:
.//div[1]/div[2]/div/div[3]/div[1]/table/tbody/tr/td/div[contains(text(), 'PL')][contains(text(),'2012-12-12')]
答案 1 :(得分:0)
虽然你可以尝试
//div[contains(text(), 'PL') and contains(text(), '2012-12-12')]