0
테이블이 있으며 특정 행 번호를 찾아야합니다. 이 경우 두 번째 행 (두 번째 tr)에 관심이 있습니다.selenium webdriver를 사용하여 테이블 행 번호 찾기
<table>
<thead>
<tbody>
<tr class="classes mico_models_classes_7 listRowWhite">
<tr class="classes mico_models_classes_8 listRowDark">
<td style="width:130px;">9:00am - 10:30am</td>
<td class="noprint enrolledFull" style="width:70px;height:40px;text-align:center;"> </td>
<td style="width:200px;">
<a class="eventName" data-eventdescription="Very long spin class" data-eventname="Spinning 90 min" href="javascript://">Spinning 90 min</a>
<br>
with
<a class="classesEmployeeName" title="John Doe" href="javascript://" data-employeeid="5117">John Doe</a>
</td>
<td style="text-align:right;width:72px;">0 of 20</td>
<td>Spin Class</td>
</tr>
<tr class="classes mico_models_classes_9 listRowWhite">
<tr class="classes mico_models_classes_10 listRowDark">
</tbody>
</table>
불행하게도, 다음 반환 dataRowIndex
에 대한 널 (null) :
String classTittle = "Spinning 90 min";
String dataRowIndex = driver.findElement(By.cssSelector("[data-eventname='" + classTitle + "']")).getAttribute("rowIndex");
나는 findelement가 작동하고 iteration을 피할 수 있다고 가정하고 있었지만 작동시키지 못했습니다. 반복은 완벽하게 작동했습니다. –