<table class="ui-table Schedule detailed">
<thead>
<tbody>
<tr id="Row00000" class="Schedule-row 0" data-Schedule-id="0">
<tr id="Row00001" class="Schedule-row 0 odd" data-Schedule-id="0">
<tr id="Row00002" class="Schedule-row 0" data-Schedule-id="0">
<tr id="Row00003" class="Schedule-row 0 odd" data-Schedule-id="0">
<tr id="Row00004" class="Schedule-row 0" data-Schedule-id="0">
<tr id="Row00005" class="Schedule-row 82 odd" data-Schedule-id="82">
<tr id="Row00006" class="Schedule-row 80" data-Schedule-id="80">
<tr id="Row00007" class="Schedule-row 79 odd" data-Schedule-id="79">
<tr id="Row00008" class="Schedule-row 0" data-Schedule-id="0">
<tr id="Row00009" class="Schedule-row 0 odd" data-Schedule-id="0">
<tr id="Row00010" class="Schedule-row 0" data-Schedule-id="0">
<tr id="Row00011" class="Schedule-row 0 odd" data-Schedule-id="0">
<tr id="Row00012" class="Schedule-row 0" data-Schedule-id="0">
<tr id="Row00013" class="Schedule-row 0 odd" data-Schedule-id="0">
<tr id="Row00014" class="Schedule-row 0" data-Schedule-id="0">
<td class="hidden col-id-personNo" data-col-id="personNo"/>
<td class="active w130 col-id-TsDate indicate first yellow" data-col-id="TsDate">
<td class="hidden w100 col-id-StartTime" data-col-id="StartTime"/>
<td class="active col-id-TaskId" data-col-id="TaskId"/>
<td class="hidden col-id-OriginalKey" data-col-id="OriginalKey"/>
<td class="hidden col-id-ScheduleId" data-col-id="ScheduleId"/>
<td class="hidden col-id-TsStatus" data-col-id="TsStatus"/>
<td class="hidden col-id-Quantity" data-col-id="Quantity"/>
<td class="active check w25 col-id-Selected" data-col-id="Selected"/>
<td class="active buttons col-id-RowButton" data-col-id="RowButton"/>
</tr>
<tr id="Row7d6251f9-f6ea-48bb-90fb-356725307245" class="Schedule-row -1 new odd" data-Schedule-id="-1">
我有這段代碼。基本上我有一個很多行的表。使用Webdriver(Java)我可以單擊一個按鈕,然後用隨機ID生成一個新行(在這種情況下,Row7d6251f9-f6ea-48bb-90fb-356725307245)。如何使用Webdriver(Java)獲取下一個隨機生成的父ID
案例1:我知道的第一行會一直固定數量Row00000。我可以使用while循環並遞增數字,直到我沒有得到Row00015。這意味着最後一個固定行號是Row00014。我可以把Row00014作爲我的基礎參考,下一個父母就是我想要的。
如何跳轉到下一個父級(忽略屬於Row00014的所有子級)並獲取新隨機生成的ID?
案例2:如果表是空的,每當webdriver的點擊一個按鈕,它會創建一個新的隨機行ID。
<table class="ui-table Schedule detailed">
<thead>
<tbody>
<tr id="Row7d6251f9-f6ea-48bb-90fb-356725307245" class="Schedule-row -1 new odd" data-Schedule-id="-1">
在這種情況下,我不會有任何基準的參考。我如何使用動態隨機ID搜索該新行?
謝謝。
「跳到下一位家長(忽略屬於Row00014的所有孩子)」是什麼意思? –
我認爲動態xpath可以幫助你。但爲此,你需要一些先決條件。可以共享任何模式,如Row7d6251f9-f6ea-48bb-90fb-356725307245意味着Row7或Row00007是您點擊或相同的事物或id正在生成沒有任何模式的按鈕 –
什麼是數據Schedule-id,如果你點擊2或3按鈕..是否像數據Schedule-id = 2第二次點擊或其他..其實它是由你的JS完成,所以不能說它是如何發生的 –