vendredi 30 septembre 2016

Robot Framework - get span element from table

I'm trying to write some test cases to automatically test my websites but I'm having trouble clicking on checkbox witch is situated on every single row in the left column. User can click on every cell in the row he wants and checkbox will became checked or unchcked..

But I'm not able to simulate this click into table cell. First I'm trying to get some cell into variable and then to click on this cell using this variable like this:

    Page Should Contain Element     xpath=//div[contains(@id,'-tableCtrlCnt')]
    ${item1}    Get Table Cell  xpath=//div[contains(@id,'-tableCtrlCnt')]/table/tbody  1   2
    Click Element   ${item1}

But I'm getting error on the second line of code, I just cannot get the column.
The error/fail is:

Cell in table xpath=//div[contains(@id,'-tableCtrlCnt')]/table/tbody in row #2 and column #2 could not be found.

And this is how part of my html code looks like:

<div id="__table1-tableCtrlCnt" class="sapUiTableCtrlCnt" style="height: 160px;">
<table id="__table1-table" role="presentation" data-sap-ui-table-acc-covered="overlay,nodata" class="sapUiTableCtrl sapUiTableCtrlRowScroll sapUiTableCtrlScroll" style="min-width:648px">
<tbody>
<tr id="__table1-rows-row0" data-sap-ui="__table1-rows-row0" class="sapUiTableRowEven sapUiTableTr" data-sap-ui-rowindex="0" role="row" title="Click to select or press SHIFT and click to select a range" style="height: 32px;">
<td role="rowheader" aria-labelledby="__table1-ariarowheaderlabel" headers="__table1-colsel" aria-owns="__table1-rowsel0"></td>
<td id="__table1-rows-row0-col0" tabindex="-1" role="gridcell" headers="__table1_col0" aria-labelledby="__table1-0" style="text-align:left" class="sapUiTableTd sapUiTableTdFirst">
  <div class="sapUiTableCell">
  <span id="__text37-col0-row0" data-sap-ui="__text37-col0-row0" title="1010"   class="sapMText sapMTextMaxWidth sapMTextNoWrap sapUiSelectable" style="text-align:left">1010
  </span>
  </div>
</td>
<td id="__table1-rows-row0-col1" tabindex="-1" role="gridcell" headers="__table1_col1" aria-labelledby="__table1-1" style="text-align:left" class="sapUiTableTd">
  <div class="sapUiTableCell">
  <span id="__text38-col1-row0" data-sap-ui="__text38-col1-row0" title="Company Code 1010" class="sapMText sapMTextMaxWidth sapMTextNoWrap sapUiSelectable" style="text-align:left">Company Code 1010
  </span>
  </div>
</td>
</tr>
...
</tbody>
</table>
</div>

Don't you have any idea how to solve this click into table issue?

Aucun commentaire:

Enregistrer un commentaire