mardi 29 septembre 2020

TestNG drag and drop issue

I need to do a drag and drop in my website .I have successfully drag and hold my element but I am facing difficulty o drop my element.

@Test (priority=8)
 public void openSectionArrow() throws InterruptedException {
          Thread.sleep(3000);
          driver.findElement(By.xpath("//*[@id=\"section-sortable\"]/div/div[1]/div[1]/span/a")).click();
          System.out.println("click on section arrow");
 }
    @Test (priority=8)
    public void dragDrop() throws InterruptedException {
          WebElement srcElement = driver.findElement(By.xpath("/html/body/app-root/app-wrapper/app-template-manager/div/main/div/app-home/div/div/div[2]/div/div[3]/div/div[1]/div[2]/div/div/div/div[1]/div/div[1]"));
          WebElement targetElement = driver.findElement(By.xpath("/html/body/app-root/app-wrapper/app-template-manager/div/main/div/app-home/div/div/div[2]/div/div[2]/div[2]/div[2]/div/div[1]/div/div[2]/div/div/div[1]/gridster/div[2]"));
          Actions builder = new Actions(driver);
          builder.clickAndHold(srcElement).perform(); 
          Thread.sleep(5000);
          builder.moveToElement(targetElement).release().build().perform();       
    }
   

Aucun commentaire:

Enregistrer un commentaire