2015-12-02 91 views
0

我是新手Selenium IDE用戶。我試圖「點擊」ID爲動態的表中的項目;當從表格添加或刪除新項目時,它會發生變化。具體項目在[td id =「GroupsNotAssigned_LBI2T0」]下面的HTML代碼末尾標識。與id關聯的項目文本是[NPM讀寫數據和只讀保留]。硒IDE:包含動態ID的表項

在此先感謝您的幫助 使用Selenium IDE 2.9 使用Firefox 42.0

<td id="frmProfile_4_2" class="dxflGroupCell"> 
<table class="dxflCLTSys dxflItemSys dxflCustomItemSys dxflItem" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-collapse:separate;"> 
<tbody> 
<tr> 
<td class="dxflHALSys dxflVATSys dxflCaptionCell dxflCaptionCellSys" style="width: 98px;"> 
<label class="dxflCaption">Not a member of:</label> 
</td> 
</tr> 
<tr> 
<td class="dxflNestedControlCellSys dxflNestedControlCell"> 
<input id="GroupsNotAssignedDeletedItems" type="hidden" value="" name="GroupsNotAssignedDeletedItems"> 
<input id="GroupsNotAssignedInsertedItems" type="hidden" value="" name="GroupsNotAssignedInsertedItems"> 
<input id="GroupsNotAssignedCustomCallback" type="hidden" value="" name="GroupsNotAssignedCustomCallback"> 
<table id="GroupsNotAssigned" class="dxeListBox_BFS2014 " cellspacing="0" cellpadding="0" style="height:250px;width:250px;border-collapse:collapse;border-collapse:separate;"> 
<tbody> 
<tr> 
<td> 
<div id="GroupsNotAssigned_D" class="dxlbd" style="height: 246px; width: 248px; overflow: auto;" tabindex="-1"> 
<input id="GroupsNotAssigned_VI" type="hidden" name="GroupsNotAssigned" value="113"> 
<table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-collapse:separate;visibility:hidden!important;display:none!important;"> 
<tbody> 
<tr id="GroupsNotAssigned_LBI-1" class="dxeListBoxItemRow_BFS2014"> 
<td id="GroupsNotAssigned_LBI-1T0" class="dxeListBoxItem_BFS2014"> </td> 
</tr> 
</tbody> 
</table> 
<table id="GroupsNotAssigned_LBT" cellspacing="0" cellpadding="0" style="width: 100%; border-collapse: separate;"> 
<tbody> 
<tr class="dxeListBoxItemRow_BFS2014"> 
<tr class="dxeListBoxItemRow_BFS2014"> 
<tr class="dxeListBoxItemRow_BFS2014"> 
<td id="GroupsNotAssigned_LBI2T0" class="dxeListBoxItem_BFS2014">NPM Read Write Data and Read Only Reserves</td> 
</tr> 

[代碼圖像1]

enter image description here

回答

0

不知道你想做什麼,但它看起來像這應該工作:

<tr> 
    <td>click</td> 
    <td>//td[contains(@id,"GroupsNotAssigned_LBI"]</td> 
    <td></td> 
</tr> 
+0

謝謝...我的問題是LBI中的「2」...字符串是動態的...有時它是2和其他時間它可能是一些其他整數...我一直在試圖弄清楚以達到「NPM讀寫數據和只讀儲備」的標題,但我似乎無法找到正確的目標。 –

+0

我編輯我的答案,我認爲你要求動態:我們只檢查GroupsNotAssigned_LBI,所以2TO可以是任何東西。 – DMart

+0

我感謝你的幫助。我的問題是「GroupsNotAssigned_LBI」標籤包含項目列表;每個項目由一個整數指定,但整數隨着用戶與項目列表的交互而改變。測試包括從列表中選擇一個項目並將其移至應用程序中的另一個表格。再次感謝。 @DMart –