我要在同一行中根据用户的电子邮件单击“单击以删除用户”链接,如下所示。请建议使用XPath或其他更好的选项来查找并单击使用Selenium Webdriver。
表行的HTML如下:
<tbody id="userlist">
<tr>
<td>
</td>
<td>
auser1@gmail.com
</td>
<td>
</td>
<td>
Student
</td>
<td class="status-img">
<a href="javascript:void(0);" data-toggle="tooltip" data-placement="top" title="" onclick="javascript:confirmUserStatusChange(1,"/User/UpdateStatus?userId=70070&status=3&URLID=ipcenyi87att6vfqib7szg")" data-original-title="Click to disable user"><i class="fa fa-user fa-green fa-fw fa-2x"></i></a>
<a href="javascript:void(0);" data-toggle="tooltip" data-placement="top" title="" onclick="javascript:user_editUser("/User/AddUser?userId=70070&URLID=uazyqtod2f0w0oxqhjqasq")" data-original-title="Click to edit user"><i class="fa fa-pencil fa-fw fa-2x"></i></a>
<a href="javascript:void(0);" data-toggle="tooltip" data-placement="top" title="" onclick="javascript:user_confirmDeleteUser("", "/User/DeleteUser?userId=70070&URLID=uazyqtod2f0w0oxqhjqasq")" data-original-title="Click to delete user"><i class="fa fa-times fa-fw fa-2x"></i></a>
</td>
</tr>
答案 0 :(得分:0)
这应该工作:
//tr[td[normalize-space()="auser1@gmail.com"]]/td/a[@data-original-title="Click to delete user"]