基於名稱單擊超鏈接的最佳方式下面是html代碼,這是我的.html頁面的結構。我有一個很長的頁面,但樣品的目的,我只有三排,而在實際的網頁我有數百什麼是使用硒WebDriver c#
我的問題是:什麼是完成以下任務的最佳方式:
我怎麼會點擊Add to Basket
作爲員工姓名John Steven(或其他任何名字)?
<table class="gvlist" cellspacing="0" border="0" id="ctl00_ctl00_Features_Features_ContentList_gv">
<tr class="gvheader">
<th>
Employee Name
</th>
<th>
Topic
</th>
<th>
Add Employee
</th>
</tr>
<tr class="gvrow">
<td>
<a id="ctl00_employee_List_gv_ctl02_lnkPage" class="gvtitle" href="#" target="_blank">
Erich Schulz</a>
</td>
<td>
<ul class="topiclist">
<li class="ListItem" style="list-style: none"><a id="ctl00_employee_List_gv_ctl02_lbTopic"
class="InlineItemText" href="#">R&D</a> </li>
</ul>
</td>
<td>
<a id="ctl00_employee_List_gv_ctl02_lnkSelect" href="#" class="addpage">Add to Basket
List</a>
</td>
</tr>
<tr class="gvrow">
<td>
<a id="ctl00_employee_List_gv_ctl03_lnkPage" class="gvtitle" href="#" target="_blank">
John Steven</a>
</td>
<td>
<ul class="topiclist">
<li class="ListItem" style="list-style: none"><a id="A2" class="InlineItemText" href="#">
Development</a> </li>
</ul>
</td>
<td>
<a id="ctl00_employee_List_gv_ctl03_lnkSelect" href="#" class="addpage">Add to Basket
List</a>
</td>
</tr>
<tr class="gvrow">
<td>
<a id="ctl00_employee_List_gv_ctl04_lnkPage" class="gvtitle" href="#" target="_blank">
John McAfee</a>
</td>
<td>
<ul class="topiclist">
<li class="ListItem" style="list-style: none"><a id="A5" class="InlineItemText" href="#">
Tech</a> </li>
</ul>
</td>
<td>
<a id="ctl00_employee_List_gv_ctl04_lnkSelect" href="#" class="addpage">Add to Basket
List</a>
</td>
</tr>
</table>
完美,謝謝 –