0
我需要識別窗體頁腳處的頁面導航按鈕,如果它處於活動狀態,請單擊>>>(最後一頁)按鈕,否則不要單擊它。如何識別HTML頁面頁腳中的頁面導航按鈕在Selenium中單擊它?
<table id="prefixmasterListForm:prefixMasterTable:j_id256_table" class="rich-dtascroller-table " cellspacing="1" cellpadding="0" border="0" style="text-align:right">
<tbody>
<tr>
<td class="rich-datascr-button-dsbld rich-datascr-button">
««
</td>
<td class="rich-datascr-button-dsbld rich-datascr-button"></td>
<td class="rich-datascr-act ">
1
</td>
<td class="rich-datascr-inact " onclick="Event.fire(this, 'rich:datascroller:onscroll', {'page': '2'});"></td>
<td class="rich-datascr-inact " onclick="Event.fire(this, 'rich:datascroller:onscroll', {'page': '3'});"></td>
<td class=" rich-datascr-button" onclick="Event.fire(this, 'rich:datascroller:onscroll', {'page': 'next'});"></td>
<td class=" rich-datascr-button" onclick="Event.fire(this, 'rich:datascroller:onscroll', {'page': 'last'});"></td>
</tr>
</tbody>
在上述情況下的第一頁< < <被禁用,而最後一個按鈕被啓用。所以我需要使用DOM或XPath在Selenium中執行以下兩項操作: -
1)檢查是否已啓用 2)單擊該按鈕。
那麼什麼是DOM或XPath來獲得適當的元素點擊?
您可以使用xpath獲取表中td的類。我認爲在類rich-datascr-button-dsbld rich-datascr-button中,dsbld指定該按鈕被禁用。您可以使用String類包含方法來確定文本是否存在於類中。如果存在,則按鈕被禁用。否則啓用。這只是一個預感。讓我知道這個是否奏效。 – Vinay
您需要Selenium IDE或java/python/etc的代碼 –