Both functions works great on its own. But when I put them together. After I and the first element, I can’t drag and the same element in the empty .

   //drag and drop first element         
    driver.findElement(By.xpath("xpath for tab 1")).click();
    WebElement drag1 = driver.findElement(By.xpath("element in tab 1"));
    WebElement drop= driver.findElement(By.xpath("emtpy table"));
    Actions action2 = new Actions(driver); 
    action2.dragAndDrop(drag1, drop).build().perform();

//drag and drop second element 
    driver.findElement(By.xpath("open tab 2")).click();
    WebElement drag2= driver.findElement(By.id("element in tab 2"));
    WebElement drop= driver.findElement(By.xpath("same emtpy table above"));
    Actions action = new Actions(driver);   
   action.clickAndHold(drag2).moveToElement(drop2).release(drop2).perform();

the empty table

  <div tabindex="10" style="position: relative; overflow: hidden; height: 
    159px; width: 766px;" class="v-scrollable v-table-body-wrapper v-table- 
     body"><div style="height: 0px;" class="v-table-body-noselection"><div style="height: 10px;" class="v-table-row-spacer"></div><table class="v-table-table"><tbody></tbody></table><div style="height: 21px;" class="v-table-row-spacer"></div></div><div tabindex="-1" style="position: fixed; top: 0px; left: 0px;"></div></div>



Source link https://sqa.stackexchange.com/questions/34477/how-to-drag-and-drop-two--in-the-same-table--

LEAVE A REPLY

Please enter your comment!
Please enter your name here