Frage

I have a page divided into 2 datagrids, left datagrid has a following structure:

<ul class="left_dg">
    <li>
        <ul></ul>
    </li>
    <li>
        <ul></ul>
    </li>
    <li>
        <ul></ul>
    </li>
    ...
</ul>

The right datagrid has a simple 'ul-li' structure and has a class="right_dg". I'm moving li-elements from the right with dragAndDropToObject to the left. It looks like this:

<tr>
    <td>dragAndDropToObject</td>
    <td>css=.right_dg > li:nth-child(2)</td>
    <td>css=.left_dg > li:nth-child(1) > ul</td>
</tr>
<tr>
    <td>dragAndDropToObject</td>
    <td>css=.right_dg > li:nth-child(2)</td>
    <td>css=.left_dg > li:nth-child(2) > ul</td>
</tr>
<tr>
    <td>dragAndDropToObject</td>
    <td>css=.right_dg > li:nth-child(2)</td>
    <td>css=.left_dg > li:nth-child(3) > ul</td>
</tr>

For some reason <td>css=.left_dg > li:nth-child(1) > ul</td> chooses a child of the second li-element, not the first one.

How could I reach a child of the first li? Many thanks for undrerstanding. I'm a novice with Selenium.

War es hilfreich?

Lösung

Don't know why such thing happens. But you could use the following code to reach the first element:

<tr>
     <td>mouseDownAt</td>
     <td>css=.right_dg > li:nth-child(2)</td>
     <td></td>
</tr>
<tr>
      <td>mouseMoveAt</td>
      <td>css=.left_dg > li:nth-child(1) > ul</td>
      <td></td>
</tr>
<tr>
      <td>mouseUpAt</td>
       <td>css=.left_dg > li:nth-child(1) > ul</td>
       <td></td>
</tr>

For second, third, etc. elements you can keep using dragAndDropToObject. That should work fine.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top