Я пытаюсь найти способ найти EXT JS 5 Gridpanel с использованием Selenium. Я могу использовать Xpath, чтобы добраться до gridpanel, но это не идеально. Это потому, что у меня есть 2 сетки на одном уровне, поэтому Xpath для обоих, похоже, получается одинаковым. В Selenium У меня есть настройки PageObjects для моего приложения здесь, как я нахожу сетки в настоящее время:Selenium и ExtJS 5 Выбор сетки
public static WebElement sourceGrid(WebDriver driver){
element = driver.findElement(By.xpath("//div[2]/div/div/div/div[3]/div/div[2]/table/tbody/tr/td/div"));
return element;
}
У меня есть атрибут ЦБС на сетке, но она никогда не сможет его найти. Вот что DOM выглядит следующим образом:
<div id="t_precautionsSourceGrid-body" data-ref="body" class="x-panel-body x-grid-with-row-lines x-grid-body x-panel-body-default x-panel-body-default x-noborder-rbl" role="presentation" style="width: 506px; left: 0px; top: 48px; height: 734px;">
<div class="x-grid-view x-grid-with-row-lines x-fit-item x-grid-view-default x-unselectable" id="tableview-1168" tabindex="0" componentid="tableview-1168" style="overflow: auto; margin: 0px; width: 506px; height: 733px;">
<div role="presentation" style="width: 1px; height: 1px; margin-top: -1px; position: absolute; left: 0px; display: none;" id="ext-element-11"></div>
<div class="x-grid-item-container" style="width: 506px; transform: translate3d(0px, 0px, 0px);">
<table id="tableview-1168-record-439" data-boundview="tableview-1168" data-recordid="439" data-recordindex="0" class="x-grid-item x-grid-item-selected" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">C.Diff (Clostridium Difficile)</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
<table id="tableview-1168-record-440" data-boundview="tableview-1168" data-recordid="440" data-recordindex="1" class="x-grid-item" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">Combative</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
<table id="tableview-1168-record-441" data-boundview="tableview-1168" data-recordid="441" data-recordindex="2" class="x-grid-item" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">Falls Alert</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
<table id="tableview-1168-record-442" data-boundview="tableview-1168" data-recordid="442" data-recordindex="3" class="x-grid-item" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">MRSA (Methicillin Resistant Staphylococcus Aureus)</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
<table id="tableview-1168-record-443" data-boundview="tableview-1168" data-recordid="443" data-recordindex="4" class="x-grid-item" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">Respiratory</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
<table id="tableview-1168-record-444" data-boundview="tableview-1168" data-recordid="444" data-recordindex="5" class="x-grid-item" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">Reverse Isolation</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
<table id="tableview-1168-record-445" data-boundview="tableview-1168" data-recordid="445" data-recordindex="6" class="x-grid-item" cellpadding="0" cellspacing="0" style=";width:0">
<tbody>
<tr class=" x-grid-row">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1166 x-grid-cell-first x-unselectable" style="width:476px;" tabindex="-1" data-columnid="gridcolumn-1166">
<div unselectable="on" class="x-grid-cell-inner " style="text-align:left;">VRE (Vancomycin Resistant Enterococci)</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-actioncolumn-1167 x-action-col-cell x-grid-cell-last x-unselectable" style="width:30px;" tabindex="-1" data-columnid="actioncolumn-1167">
<div unselectable="on" class="x-grid-cell-inner x-grid-cell-inner-action-col" style="text-align:left;"><img role="button" alt="" src="Images/add.png" class="x-action-col-icon x-action-col-0 " data-qtip="Add"></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Я знаю, что это почти невозможно, чтобы посмотреть, какие-либо предложения, как сделать его лучше отформатирован здесь?
Итак, по существу, я хочу, чтобы тест попал в сетку, нажмите на первый элемент, а затем убедитесь, что он находится во второй сетке. При этом предполагается, что для начала используется свежая сетка источника и выбранная сетка.
Я пробовал много разных подходов. Добавление статического элемента id в столбцы сетки с помощью Jsoup, пытающегося создать обертки для компонентов EXT. Я еще не понял, как получить библиотеку Sencha для работы в Eclipse (Luna), если бы я мог работать, тогда я мог бы получить доступ к таким вещам, как Ext.ComponentQuery и т. Д.
Угадайте, что было два вопроса.
использовать класс .x-grid-view up div – Raghavendra
использовать это // div [содержит (@class, '.x-grid-view up')]/parent – Raghavendra
Благодарим за редактирование Saifur. – tesposito