Drag and drop doesn't work with React JS web app

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Drag and drop doesn't work with React JS web app

Pradeep P
Hi,

I'm automating a React JS app and it seems like drag and drop functionality is not working. I tried all different ways with dragAndDrop, Robot but still it doesn't work. Is there any defect here?

Actions action=new Actions(driver);
WebElement dragElement=driver.findElement(By.xpath(".//*[contains(text(),\"automation\")]/.."));
WebElement dropElement=driver.findElement(By.xpath("(.//div[@class=\"viewlet-title\"])[1]/.."));

// method 1
action.clickAndHold(dragElement).pause(2000).build().perform();
action.moveToElement(dropElement,10,10).pause(2000).build().perform();
action.release().pause(2000).build().perform();
Thread.sleep(2000);*/
//method 2
Robot robot = new Robot();
        robot.setAutoDelay(1000);
        int fromX=dragElement.getLocation().getX()+5;
        int fromY=dragElement.getLocation().getY()+5;
        int toX=dropElement.getLocation().getX()+5;
        int toY=dropElement.getLocation().getY()+5;
 
        robot.mouseMove(fromX, fromY);
        Thread.sleep(1000);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        Thread.sleep(1000);
        robot.mouseMove(toX, toY);
        Thread.sleep(1000);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        Thread.sleep(1000);*/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f8b70631-ec89-4968-a97a-5b796e9a1360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.