Unten ist ein Teil von HTML, mit dem ich Probleme habe.Selen & C# | Wie kann ich auf eine Schaltfläche in einer Tabelle klicken?
Was ich versuche zu tun: Ich verwende derzeit Selenium-Chrom-Treiber, um den Prozess der Erstellung eines Tickets auf einer Website zu durchlaufen. Auf einer bestimmten Seite muss ich einen Tab auswählen, um ein paar Checkboxen zu aktivieren (siehe unten). Sie haben jedoch alle die gleiche ID. Wie kann ich wählen (sagen die 2. TOP_TAB & TOP_BUTTON) mit Selenium-Chrom-Treiber in C# und klicken Sie auf das Element.
<input type="hidden" name="tabsize" value="5">
<td id="TOP_TAB" width="10" class="leftRightBorder" style="width: 5px;">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('0','0');" align="center" nowrap=""><img src="images/left-cor.gif" width="5" height="18" border="0"></td>
<td id="TOP_BUTTON" style="cursor: pointer; font-size: 10px; background-color: rgb(181, 200, 217); border-bottom: 2px solid rgb(181, 200, 217); font-weight: normal;"
onclick="fun_HideShowBlock('0','0');" align="center" class="drop" nowrap="" bgcolor="#B5C8D9" width="88">Addendum 02</td>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('0','0');" align="center" nowrap=""><img src="images/right-cor.gif" width="5" height="18" border="0"></td>
</tr>
</tbody>
</table>
</td>
<td id="TOP_TAB" width="10" class="leftRightBorder" style="width: 5px;">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('1','1');" align="center" nowrap=""><img src="images/left-cor-light.gif" width="5" height="18" border="0"></td>
<td id="TOP_BUTTON" style="cursor: pointer; font-size: 10px; background-color: rgb(217, 223, 239); border-bottom: 0px solid rgb(217, 223, 239); font-weight: bold;"
onclick="fun_HideShowBlock('1','1');" align="center" class="drop" nowrap="" bgcolor="#B5C8D9" width="88">Addendum 01</td>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('1','1');" align="center" nowrap=""><img src="images/right-cor-light.gif" width="5" height="18" border="0"></td>
</tr>
</tbody>
</table>
</td>
<td id="TOP_TAB" width="10" class="leftRightBorder" style="width: 5px;">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('2','2');" align="center" nowrap=""><img src="images/left-cor.gif" width="5" height="18" border="0"></td>
<td id="TOP_BUTTON" style="cursor: pointer; font-size: 10px; background-color: rgb(181, 200, 217); border-bottom: 2px solid rgb(181, 200, 217); font-weight: normal;"
onclick="fun_HideShowBlock('2','2');" align="center" class="drop" nowrap="" bgcolor="#B5C8D9" width="88">Default Job</td>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('2','2');" align="center" nowrap=""><img src="images/right-cor.gif" width="5" height="18" border="0"></td>
</tr>
</tbody>
</table>
</td>
<td id="TOP_TAB" width="10" class="leftRightBorder" style="width: 5px;">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('3','3');" align="center" nowrap=""><img src="images/left-cor.gif" width="5" height="18" border="0"></td>
<td id="TOP_BUTTON" style="cursor: pointer; font-size: 10px; background-color: rgb(181, 200, 217); border-bottom: 2px solid rgb(181, 200, 217); font-weight: normal;"
onclick="fun_HideShowBlock('3','3');" align="center" class="drop" nowrap="" bgcolor="#B5C8D9" width="88">Default Job</td>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('3','3');" align="center" nowrap=""><img src="images/right-cor.gif" width="5" height="18" border="0"></td>
</tr>
</tbody>
</table>
</td>
<td id="TOP_TAB" width="10" class="leftRightBorder" style="width: 5px;">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('4','4');" align="center" nowrap=""><img src="images/left-cor.gif" width="5" height="18" border="0"></td>
<td id="TOP_BUTTON" style="cursor: pointer; font-size: 10px; background-color: rgb(181, 200, 217); border-bottom: 2px solid rgb(181, 200, 217); font-weight: normal;"
onclick="fun_HideShowBlock('4','4');" align="center" class="drop" nowrap="" bgcolor="#B5C8D9" width="88">Default Job</td>
<td id="TOP_BUTTON" style="cursor:hand;" onclick="fun_HideShowBlock('4','4');" align="center" nowrap=""><img src="images/right-cor.gif" width="5" height="18" border="0"></td>
</tr>
</tbody>
</table>
</td>
Ich werde XPath tun, um alle TOP_TAB Elemente auszuwählen (Schleife bis es die eine ist) und dann einen 2. XPath nach allen TOP_BUTTON suchen (Iterieren und wählen Sie den Index, den ich brauche) –