Я пытаюсь получить доступ к значку «Изменить» для определенного элемента в динамической таблице.
HTML -
<div class="fixedDataTableLayout_rowsContainer" style="height: 323px; width: 1882px;">
<div class="fixedDataTableColumnResizerLineLayout_main fixedDataTableColumnResizerLineLayout_hiddenElem public_fixedDataTableColumnResizerLine_main" style="width: 0px; height: 325px; left: 0px;">
<div class="fixedDataTableColumnResizerLineLayout_mouseArea" style="height: 325px;"></div>
</div>
<div class="fixedDataTableRowLayout_rowWrapper" style="width: 1882px; height: 48px; z-index: 1; left: 0px; top: 0px;">
<div class="fixedDataTableRowLayout_main public_fixedDataTableRow_main fixedDataTableLayout_header public_fixedDataTable_header" style="width: 1882px; height: 48px;">
<div class="fixedDataTableRowLayout_body">
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 48px; width: 0px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 48px; position: absolute; width: 0px; z-index: 2; left: 0px; top: 0px;"></div>
</div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 48px; width: 1882px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 48px; position: absolute; width: 1882px; z-index: 0; left: 0px; top: 0px;">
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 48px; width: 916px; left: 0px;">
<div class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell cell-header text-center" style="height: 48px; width: 916px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">
<div class="sort-by ">Facility
<i class="fa fa-sort-undefined" style="margin-left: 3px; position: absolute; top: -3px;"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 48px; width: 866px; left: 916px;">
<div class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell cell-header text-center" style="height: 48px; width: 866px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">
<div class="sort-by "># of rooms
<i class="fa fa-sort-undefined" style="margin-left: 3px; position: absolute; top: -3px;"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 48px; width: 100px; left: 1782px;">
<div class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1" style="height: 48px; width: 100px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="" style="left: 0px; height: 48px;"></div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 48px; width: 0px; left: 1882px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 48px; position: absolute; width: 0px; z-index: 2; left: 0px; top: 0px;"></div>
</div>
</div>
</div>
</div>
<div>
<div class="fixedDataTableRowLayout_rowWrapper" style="width: 1882px; height: 60px; z-index: 0; transform: translate3d(0px, 48px, 0px); backface-visibility: hidden;">
<div class="fixedDataTableRowLayout_main public_fixedDataTableRow_main public_fixedDataTableRow_even public_fixedDataTable_bodyRow" style="width: 1882px; height: 60px;">
<div class="fixedDataTableRowLayout_body">
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 0px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 0px; z-index: 2; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;"></div>
</div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 1882px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 1882px; z-index: 0; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;">
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 916px; left: 0px;">
<div data="[object Object],[object Object],[object Object]" field="name" class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell undefined" style="height: 60px; width: 916px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">uitestsfacility</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 866px; left: 916px;">
<div data="[object Object],[object Object],[object Object]" field="roomCount" class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell text-center" style="height: 60px; width: 866px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">1</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 100px; left: 1782px;">
<div class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell text-center" style="height: 60px; width: 100px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">
<i class="fa fa-edit" data-tip="Edit Facility"></i>
<i class="fa fa-trash-o disabled" data-tip="Cannot be deleted due to rooms or devices belonged to this facility"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="" style="left: 0px; height: 60px;"></div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 0px; left: 1882px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 0px; z-index: 2; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;"></div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableRowLayout_rowWrapper" style="width: 1882px; height: 60px; z-index: 0; transform: translate3d(0px, 108px, 0px); backface-visibility: hidden;">
<div class="fixedDataTableRowLayout_main public_fixedDataTableRow_main public_fixedDataTableRow_highlighted public_fixedDataTableRow_odd public_fixedDataTable_bodyRow" style="width: 1882px; height: 60px;">
<div class="fixedDataTableRowLayout_body">
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 0px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 0px; z-index: 2; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;"></div>
</div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 1882px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 1882px; z-index: 0; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;">
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 916px; left: 0px;">
<div data="[object Object],[object Object],[object Object]" field="name" class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell undefined" style="height: 60px; width: 916px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">testsearchfacility</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 866px; left: 916px;">
<div data="[object Object],[object Object],[object Object]" field="roomCount" class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell text-center" style="height: 60px; width: 866px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">1</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 100px; left: 1782px;">
<div class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell text-center" style="height: 60px; width: 100px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">
<i class="fa fa-edit" data-tip="Edit Facility"></i>
<i class="fa fa-trash-o disabled" data-tip="Cannot be deleted due to rooms or devices belonged to this facility"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="" style="left: 0px; height: 60px;"></div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 0px; left: 1882px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 0px; z-index: 2; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;"></div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableRowLayout_rowWrapper" style="width: 1882px; height: 60px; z-index: 0; transform: translate3d(0px, 168px, 0px); backface-visibility: hidden;">
<div class="fixedDataTableRowLayout_main public_fixedDataTableRow_main public_fixedDataTableRow_even public_fixedDataTable_bodyRow fixedDataTableLayout_hasBottomBorder public_fixedDataTable_hasBottomBorder" style="width: 1882px; height: 60px;">
<div class="fixedDataTableRowLayout_body">
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 0px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 0px; z-index: 2; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;"></div>
</div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 1882px; left: 0px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 1882px; z-index: 0; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;">
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 916px; left: 0px;">
<div data="[object Object],[object Object],[object Object]" field="name" class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell undefined" style="height: 60px; width: 916px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">AutomationFacility 1249.0</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 866px; left: 916px;">
<div data="[object Object],[object Object],[object Object]" field="roomCount" class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell text-center" style="height: 60px; width: 866px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">0</div>
</div>
</div>
</div>
</div>
<div class="fixedDataTableCellLayout_main public_fixedDataTableCell_main" style="height: 60px; width: 100px; left: 1782px;">
<div class="fixedDataTableCellLayout_wrap1 public_fixedDataTableCell_wrap1 text-cell text-center" style="height: 60px; width: 100px;">
<div class="fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wrap2">
<div class="fixedDataTableCellLayout_wrap3 public_fixedDataTableCell_wrap3">
<div class="public_fixedDataTableCell_cellContent">
<i class="fa fa-edit" data-tip="Edit Facility"></i>
<i class="fa fa-trash-o " data-tip="Delete Facility"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="" style="left: 0px; height: 60px;"></div>
<div class="fixedDataTableCellGroupLayout_cellGroupWrapper" style="height: 60px; width: 0px; left: 1882px;">
<div class="fixedDataTableCellGroupLayout_cellGroup" style="height: 60px; position: absolute; width: 0px; z-index: 2; transform: translate3d(0px, 0px, 0px); backface-visibility: hidden;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Например. Мне нужен селектор для значка редактирования в строке для AutomationFacility 9341.0. Этот элемент создается в моем тесте, а затем мне нужно щелкнуть значок «Изменить» для него. В этом случае я никогда не знаю положение элемента.
В представленном значке редактирования HTML находится в строке 183. Я пытался найти его примерно так:
$(byXpath("//*[text()='"+facilityName+"']/i[@class='fa fa-edit']")).click();
Но это не работает, и я получаю сообщение об ошибке, что селектор неверен.