gpt4 book ai didi

html - 基于文本的跨度的 XPath?

转载 作者:数据小太阳 更新时间:2023-10-29 02:55:51 32 4
gpt4 key购买 nike

我无法使用我尝试过的 XPath 找到第一个跨度:

//*[@id='student-grid']/div[2]/div[1]/table/tbody/tr[1]/td/span/span[contains(text(), 'Edit School')]

选择带文本的范围 - 编辑学生按钮

<tbody role="rowgroup">
<tr class="" data-uid="2f3646c6-213a-4e91-99f9-0fbaa5f7755d" role="row" aria-selected="false">
<td class="select-row" role="gridcell">
<td class="font-md" role="gridcell">marker, Lion</td>
<td role="gridcell">TESTLINK_1_ArchScenario</td>
<td role="gridcell">1st</td>
<td role="gridcell">Not Started</td>
<td role="gridcell"/>
<td role="gridcell"/>
<td role="gridcell">QA Automation TestLink Folders</td>
<td class="k-cell-action" role="gridcell"/>
<td class="k-cell-action detail-view-link font-md" role="gridcell">
<span class="button-grid-action kendo-lexia-tooltip icon-pencil" role="button" title="Edit Student">
<span>Edit Student</span>
</span>
</td>
<td class="k-cell-action archive-link font-md" role="gridcell">
<span class="button-grid-action kendo-lexia-tooltip icon-archive" role="button" title="Archive Student">
<span>Archive Student</span>
</span>
</td>
</tr>
</tbody>

最佳答案

如果你想select span with text - Edit Studen试试这个:

//span[@title='Edit Student']/span
//span[text()='Edit Student']

如果你想选择 Edit Studen with role="button" 试试这个:

//span[@title='Edit Student'][@role='button']
//span[@role='button'][./span[text()='Edit Student']]
//span[@role='button'][./span[.='Edit Student']]

关于html - 基于文本的跨度的 XPath?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46449200/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com