jeudi 28 novembre 2019

How to use Protractor to find a empty cell in a table

If the field is a non-empty cell, I can use filter or by.cssContainingText to find the td. But what if the the td is empty?

For example, the following table has two exactly same row. each row has 5 p-editable-column. But all columns are empty, so how can I select a specific column? e.g I want to select the second p-editable-column on the first row.

<tbody class="p-datatable-tbody">
    <tr class="p-datatable-row blackFont" draggable="false" style="height: 28px;">
        <td class="" style="min-width: 2.6em; width: 2.6em; padding: 0px; border-spacing: 0px;"></td>
        <td class="" style="min-width: 2.8em; width: 2.8em; padding: 0px; border-spacing: 0px;"><i aria-hidden="true"
                class="file outline vertically flipped icon link noteButton"></i></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
    </tr>
    <tr class="p-datatable-row blackFont" draggable="false" style="height: 28px;">
        <td class="" style="min-width: 2.6em; width: 2.6em; padding: 0px; border-spacing: 0px;"></td>
        <td class="" style="min-width: 2.8em; width: 2.8em; padding: 0px; border-spacing: 0px;"><i aria-hidden="true"
                class="file outline vertically flipped icon link noteButton"></i></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
        <td class="p-editable-column" style="width: 5em; white-space: pre-line;"><a tabindex="0"
                class="p-cell-editor-key-helper p-hidden-accessible"><span></span></a></td>
    </tr>
</tbody>

Aucun commentaire:

Enregistrer un commentaire