我无法找到我试过的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>
答案 0 :(得分:2)
如果你想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']]
答案 1 :(得分:1)
这个XPath,
//span[@role='button' and normalize-space() = 'Edit School']
将选择span
@role
button
元素Edit School
和<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MY_Championship extends CI_Controller {
protected $championship_id;
public function __construct($_championship_id)
{
parent::__construct();
$championship_id = $_championship_id;
}
public function results($page)
{
//Some code here
}
}
的规范化字符串值。当然,您可以根据需要进一步限定其遗产。
答案 2 :(得分:1)
这应该得到跨文本
//span[.='Edit Student']
答案 3 :(得分:0)
只需使用可以使用任何此xpath
handleJobException()